Summary: | msdosfs rename(2) deadlock | ||
---|---|---|---|
Product: | Base System | Reporter: | Edward Tomasz Napierala <trasz> |
Component: | kern | Assignee: | freebsd-bugs (Nobody) <bugs> |
Status: | New --- | ||
Severity: | Affects Only Me | CC: | emaste, grahamperrin, kib, pho |
Priority: | --- | ||
Version: | CURRENT | ||
Hardware: | Any | ||
OS: | Any |
Description
Edward Tomasz Napierala
2021-07-31 18:05:23 UTC
msdosfs_rename() has the same issue as was present in ufs_rename() long time ago. First, relookup() cannot be used while any vnode is locked. Instead, special non-sleeping variant of msdosfs_lookup() needs to be made available and applied there. It is already coded (dd_ino != NULL for msdosfs_lookup_() I believe), just needs to be exposed and applied. Another issue is that function prologue must not use sleepable vn_lock() when owning any other vnode lock. Mostly, it needs to mimic the structure of ufs_rename() for acquiring all three or four locks. A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/src/commit/?id=95d42526e92cb2a9842d71d3c585aabf32da7534 commit 95d42526e92cb2a9842d71d3c585aabf32da7534 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2021-08-01 17:46:59 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2021-08-27 15:39:45 +0000 msdosfs: fix rename Use the same locking algorithm for msdosfs_rename() as used by ufs_rename(). Convert doscheckpath() to non-sleeping version. Reported by: trasz PR: 257522 In collaboration with: pho Reviewed by: mckusick Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D31464 sys/fs/msdosfs/denode.h | 5 +- sys/fs/msdosfs/msdosfs_denode.c | 1 + sys/fs/msdosfs/msdosfs_lookup.c | 79 ++++---- sys/fs/msdosfs/msdosfs_vnops.c | 430 +++++++++++++++++++++------------------- 4 files changed, 274 insertions(+), 241 deletions(-) |