aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2021-01-26 11:35:21 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2021-02-12 01:02:20 +0000
commitf16c26b1c009fd0d87d07d3b1cf0d5078ad7f511 (patch)
tree16ef0b9190d089b0c7e3daf0d332a594a8f46473
parente94f2f1be32294cb6d519b6631f7522466fbbb3b (diff)
downloadsrc-f16c26b1c009fd0d87d07d3b1cf0d5078ad7f511.tar.gz
src-f16c26b1c009fd0d87d07d3b1cf0d5078ad7f511.zip
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
-rw-r--r--sys/ufs/ffs/ffs_extern.h5
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c7
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);