git: fd97fa64638d - main - Add FFSV_FORCEINODEDEP flag for ffs_vgetf()
Konstantin Belousov
kib at FreeBSD.org
Fri Mar 12 11:32:16 UTC 2021
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=fd97fa64638d810b415af7afcc86634c9709ad12
commit fd97fa64638d810b415af7afcc86634c9709ad12
Author: Konstantin Belousov <kib at FreeBSD.org>
AuthorDate: 2021-03-03 17:40:56 +0000
Commit: Konstantin Belousov <kib at FreeBSD.org>
CommitDate: 2021-03-12 11:30:38 +0000
Add FFSV_FORCEINODEDEP flag for ffs_vgetf()
It will be used to allow SU flush code to sync the volume while external
consumers see that SU is already disabled on the filesystem. Use it where
ffs_vgetf() called by SU code to process dependencies.
Reviewed by: mckusick
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D29178
---
sys/ufs/ffs/ffs_extern.h | 1 +
sys/ufs/ffs/ffs_softdep.c | 13 +++++++------
sys/ufs/ffs/ffs_vfsops.c | 3 ++-
3 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/sys/ufs/ffs/ffs_extern.h b/sys/ufs/ffs/ffs_extern.h
index 544012089046..62486941354e 100644
--- a/sys/ufs/ffs/ffs_extern.h
+++ b/sys/ufs/ffs/ffs_extern.h
@@ -127,6 +127,7 @@ int ffs_breadz(struct ufsmount *, struct vnode *, daddr_t, daddr_t, int,
#define FFSV_FORCEINSMQ 0x0001
#define FFSV_REPLACE 0x0002
#define FFSV_REPLACE_DOOMED 0x0004
+#define FFSV_FORCEINODEDEP 0x0008
/*
* Flags to ffs_reload
diff --git a/sys/ufs/ffs/ffs_softdep.c b/sys/ufs/ffs/ffs_softdep.c
index e60ac2f6868b..9c32a785a321 100644
--- a/sys/ufs/ffs/ffs_softdep.c
+++ b/sys/ufs/ffs/ffs_softdep.c
@@ -1471,7 +1471,7 @@ get_parent_vp(struct vnode *vp, struct mount *mp, ino_t inum, struct buf *bp,
ASSERT_VOP_ELOCKED(vp, "child vnode must be locked");
for (bplocked = true, pvp = NULL;;) {
error = ffs_vgetf(mp, inum, LK_EXCLUSIVE | LK_NOWAIT, &pvp,
- FFSV_FORCEINSMQ);
+ FFSV_FORCEINSMQ | FFSV_FORCEINODEDEP);
if (error == 0) {
/*
* Since we could have unlocked vp, the inode
@@ -1512,7 +1512,7 @@ get_parent_vp(struct vnode *vp, struct mount *mp, ino_t inum, struct buf *bp,
VOP_UNLOCK(vp);
error = ffs_vgetf(mp, inum, LK_EXCLUSIVE, &pvp,
- FFSV_FORCEINSMQ);
+ FFSV_FORCEINSMQ | FFSV_FORCEINODEDEP);
if (error != 0) {
MPASS(error != ERELOOKUP);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
@@ -8387,7 +8387,7 @@ handle_complete_freeblocks(freeblks, flags)
*/
if (spare && freeblks->fb_len != 0) {
if (ffs_vgetf(freeblks->fb_list.wk_mp, freeblks->fb_inum,
- flags, &vp, FFSV_FORCEINSMQ) != 0)
+ flags, &vp, FFSV_FORCEINSMQ | FFSV_FORCEINODEDEP) != 0)
return (EBUSY);
ip = VTOI(vp);
if (ip->i_mode == 0) {
@@ -10177,7 +10177,8 @@ handle_workitem_remove(dirrem, flags)
mp = dirrem->dm_list.wk_mp;
ump = VFSTOUFS(mp);
flags |= LK_EXCLUSIVE;
- if (ffs_vgetf(mp, oldinum, flags, &vp, FFSV_FORCEINSMQ) != 0)
+ if (ffs_vgetf(mp, oldinum, flags, &vp, FFSV_FORCEINSMQ |
+ FFSV_FORCEINODEDEP) != 0)
return (EBUSY);
ip = VTOI(vp);
MPASS(ip->i_mode != 0);
@@ -14269,7 +14270,7 @@ clear_remove(mp)
if (error != 0)
goto finish_write;
error = ffs_vgetf(mp, ino, LK_EXCLUSIVE, &vp,
- FFSV_FORCEINSMQ);
+ FFSV_FORCEINSMQ | FFSV_FORCEINODEDEP);
vfs_unbusy(mp);
if (error != 0) {
softdep_error("clear_remove: vget", error);
@@ -14349,7 +14350,7 @@ clear_inodedeps(mp)
return;
}
if ((error = ffs_vgetf(mp, ino, LK_EXCLUSIVE, &vp,
- FFSV_FORCEINSMQ)) != 0) {
+ FFSV_FORCEINSMQ | FFSV_FORCEINODEDEP)) != 0) {
softdep_error("clear_inodedeps: vget", error);
vfs_unbusy(mp);
vn_finished_write(mp);
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index 762874562082..f2bfe13cf89b 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -2074,7 +2074,8 @@ ffs_vgetf(mp, ino, flags, vpp, ffs_flags)
*vpp = NULL;
return (error);
}
- if (DOINGSOFTDEP(vp))
+ if (DOINGSOFTDEP(vp) && (!fs->fs_ronly ||
+ (ffs_flags & FFSV_FORCEINODEDEP) != 0))
softdep_load_inodeblock(ip);
else
ip->i_effnlink = ip->i_nlink;
More information about the dev-commits-src-main
mailing list