The branch main has been updated by kib:

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

commit f16c26b1c009fd0d87d07d3b1cf0d5078ad7f511
Author:     Konstantin Belousov <[email protected]>
AuthorDate: 2021-01-26 11:35:21 +0000
Commit:     Konstantin Belousov <[email protected]>
CommitDate: 2021-02-12 01:02:20 +0000

    ffs: Add FFSV_REPLACE_DOOMED flag to ffs_vgetf()
    
    It specifies that caller requests a fresh non-doomed vnode.  If doomed
    vnode is found in the hash, it should behave similarly to FFSV_REPLACE.
    Or, to put it differently, the flag is same as FFSV_REPLACE, but only
    when the found hashed vnode is doomed.
    
    Reviewed by:    chs, mkcusick
    Tested by:      pho
    MFC after:      2 weeks
    Sponsored by:   The FreeBSD Foundation
---
 sys/ufs/ffs/ffs_extern.h | 5 +++--
 sys/ufs/ffs/ffs_vfsops.c | 7 +++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/sys/ufs/ffs/ffs_extern.h b/sys/ufs/ffs/ffs_extern.h
index d54df1deced9..bdb3f533e1ad 100644
--- a/sys/ufs/ffs/ffs_extern.h
+++ b/sys/ufs/ffs/ffs_extern.h
@@ -122,8 +122,9 @@ int ffs_breadz(struct ufsmount *, struct vnode *, daddr_t, 
daddr_t, int,
 /*
  * Flags to ffs_vgetf
  */
-#define        FFSV_FORCEINSMQ 0x0001
-#define        FFSV_REPLACE    0x0002
+#define        FFSV_FORCEINSMQ         0x0001
+#define        FFSV_REPLACE            0x0002
+#define        FFSV_REPLACE_DOOMED     0x0004
 
 /*
  * Flags to ffs_reload
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index 04afbfd4d6e4..91b8c30f0919 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -1954,13 +1954,16 @@ ffs_vgetf(mp, ino, flags, vpp, ffs_flags)
        daddr_t dbn;
        int error;
 
-       MPASS((ffs_flags & FFSV_REPLACE) == 0 || (flags & LK_EXCLUSIVE) != 0);
+       MPASS((ffs_flags & (FFSV_REPLACE | FFSV_REPLACE_DOOMED)) == 0 ||
+           (flags & LK_EXCLUSIVE) != 0);
 
        error = vfs_hash_get(mp, ino, flags, curthread, vpp, NULL, NULL);
        if (error != 0)
                return (error);
        if (*vpp != NULL) {
-               if ((ffs_flags & FFSV_REPLACE) == 0)
+               if ((ffs_flags & FFSV_REPLACE) == 0 ||
+                   ((ffs_flags & FFSV_REPLACE_DOOMED) == 0 ||
+                   !VN_IS_DOOMED(*vpp)))
                        return (0);
                vgone(*vpp);
                vput(*vpp);
_______________________________________________
[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