git: bb536de6c0d7 - main - ffs_update(): Do not assume that EBUSY can only come LK_NOWAIT trylock
Konstantin Belousov
kib at FreeBSD.org
Tue Aug 31 04:38:55 UTC 2021
The branch main has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=bb536de6c0d73566e610881e12c55489a7c6ec44
commit bb536de6c0d73566e610881e12c55489a7c6ec44
Author: Konstantin Belousov <kib at FreeBSD.org>
AuthorDate: 2021-08-26 16:17:39 +0000
Commit: Konstantin Belousov <kib at FreeBSD.org>
CommitDate: 2021-08-31 04:38:35 +0000
ffs_update(): Do not assume that EBUSY can only come LK_NOWAIT trylock
Instead do protective check for the local flags and do not interpret
EBUSY specially if we did not request trylock mode for bread().
Reviewed by: mckusick
Reported and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
---
sys/ufs/ffs/ffs_inode.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/sys/ufs/ffs/ffs_inode.c b/sys/ufs/ffs/ffs_inode.c
index 2bc3da7e603f..1159259fb2b6 100644
--- a/sys/ufs/ffs/ffs_inode.c
+++ b/sys/ufs/ffs/ffs_inode.c
@@ -153,9 +153,14 @@ loop:
error = ffs_breadz(VFSTOUFS(vp->v_mount), ITODEVVP(ip), bn, bn,
(int) fs->fs_bsize, NULL, NULL, 0, NOCRED, flags, NULL, &bp);
if (error != 0) {
- if (error != EBUSY)
+ /*
+ * If EBUSY was returned without GB_LOCK_NOWAIT (which
+ * requests trylock for buffer lock), it is for some
+ * other reason and we should not handle it specially.
+ */
+ if (error != EBUSY || (flags & GB_LOCK_NOWAIT) == 0)
return (error);
- KASSERT((IS_SNAPSHOT(ip)), ("EBUSY from non-snapshot"));
+
/*
* Wait for our inode block to become available.
*
More information about the dev-commits-src-main
mailing list