The branch stable/13 has been updated by kib:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=cac4051570d9feb18a05084f327b86b53114acac

commit cac4051570d9feb18a05084f327b86b53114acac
Author:     Konstantin Belousov <[email protected]>
AuthorDate: 2021-03-03 17:40:56 +0000
Commit:     Konstantin Belousov <[email protected]>
CommitDate: 2021-08-14 10:21:58 +0000

    Add FFSV_FORCEINODEDEP flag for ffs_vgetf()
    
    (cherry picked from commit fd97fa64638d810b415af7afcc86634c9709ad12)
---
 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 0365cb76601e..c0ceeee09e89 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 e03f88029340..37db84f06fd0 100644
--- a/sys/ufs/ffs/ffs_softdep.c
+++ b/sys/ufs/ffs/ffs_softdep.c
@@ -1470,7 +1470,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
@@ -1511,7 +1511,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);
@@ -8413,7 +8413,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) {
@@ -10203,7 +10203,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);
@@ -14295,7 +14296,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);
@@ -14375,7 +14376,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 c8073874a85f..0e8a13b87eec 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -2073,7 +2073,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;
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to