Skip to content

nfsd shoudn't call mnt_want_write twice

J. Bruce Fields linux-nfs 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2nfsd: allow fh_want_write to be called twicefs/nfsd/vfs.h+4 -10 replies
2/2nfsd: fh_drop_write in nfsd_unlinkfs/nfsd/vfs.c+5 -30 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] nfsd shoudn't call mnt_want_write twice

From: "J. Bruce Fields" <[email protected]>

A fuzzer recently triggered lockdep warnings about potential sb_writers deadlocks caused by fh_want_write, showing that we haven't been careful to pair each fh_want_write() with an fh_drop_write().

This isn't normally a problem since fh_put() will call fh_drop_write() for us. And that's OK for NFSv3. But an NFSv4 protocol fuzzer can do weird things like call unlink twice in a compound.

So we can either make it safe to call fh_want_write() twice, or we can fix all the callers to call fh_drop_write().

For now I think we have to do the former just to get the bug fixed.

Long term I don't know whether it's best to stay with that or to fix up the callers. I fixed nfsd_unlink just because it's easy, but maybe that's pointless, it's others (like setattr) that are the complicated ones.

J. Bruce Fields (2):
nfsd: allow fh_want_write to be called twice
nfsd: fh_drop_write in nfsd_unlink

 fs/nfsd/vfs.c | 8 +++++---
 fs/nfsd/vfs.h | 5 ++++-
 2 files changed, 9 insertions(+), 4 deletions(-)
Signature · 1 line
2.21.0