Call softdep_prealloc() before taking ffs_lock_ea(), if unlock is committing

softdep_prealloc() must be called to ensure enough journal space is
available, before ffs_extwrite(). Also it must be done before taking
ffs_lock_ea(), because it calls ffs_syncvnode(), potentially dropping
the vnode lock.

Reviewed by:	mckusick
Tested by:	pho
MFC after:      1 week
Sponsored by:   The FreeBSD Foundation
This commit is contained in:
Konstantin Belousov 2021-02-21 12:11:54 +02:00
parent 5e198e7646
commit 6f30ac9995

View File

@ -1552,6 +1552,12 @@ struct vop_closeextattr_args {
if (ap->a_commit && (vp->v_mount->mnt_flag & MNT_RDONLY) != 0)
return (EROFS);
if (ap->a_commit && DOINGSUJ(vp)) {
ASSERT_VOP_ELOCKED(vp, "ffs_closeextattr commit");
softdep_prealloc(vp, MNT_WAIT);
if (vp->v_data == NULL)
return (EBADF);
}
return (ffs_close_ea(vp, ap->a_commit, ap->a_cred, ap->a_td));
}
@ -1600,6 +1606,13 @@ vop_deleteextattr {
return (error);
}
if (DOINGSUJ(vp)) {
ASSERT_VOP_ELOCKED(vp, "ffs_deleteextattr");
softdep_prealloc(vp, MNT_WAIT);
if (vp->v_data == NULL)
return (EBADF);
}
error = ffs_open_ea(vp, ap->a_cred, ap->a_td);
if (error)
return (error);
@ -1801,6 +1814,13 @@ vop_setextattr {
return (error);
}
if (DOINGSUJ(vp)) {
ASSERT_VOP_ELOCKED(vp, "ffs_deleteextattr");
softdep_prealloc(vp, MNT_WAIT);
if (vp->v_data == NULL)
return (EBADF);
}
error = ffs_open_ea(vp, ap->a_cred, ap->a_td);
if (error)
return (error);