Re: [PATCH 07/25] r/o bind mounts: elevate write count for some ioctls

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Andrew Morton <akpm@...>
Cc: <linux-kernel@...>, <hch@...>, viro <viro@...>
Date: Friday, September 21, 2007 - 5:15 pm

On Fri, 2007-09-21 at 01:17 -0700, Andrew Morton wrote:

Just brainstorming a bit...  I tried just keeping a writer count in the
superblock which we bump at the same time as the mnt->__mnt_writers,
which makes it quite easy to check whenever we have the inode around.
This causes quite a few false positives with journal code, and I think a
few more with direct block device access.  I think we can work around
those, though.

The true issue comes when we have a lot of users (more than one) of a
superblock.  If anybody has a write request outstanding, then the check
I put in will get skipped.  It's easy to mask real problems this way.

Putting the "inodes allowed" list in the task (or probably signal struct
to support threads) should be workable, but I worry a bit about the
cases where fds are sent across sockets.

We could also break up the mnt_want_write() requests into two classes,
the common mnt_want_write() case and mnt_want_indefinite_write() or
something.  The plain (and common) case is the one for things like
rmdir, mknod, or chmod where the write is confined to a single syscall.
mnt_want_indefinite_write() would be for things that do an open() and
later work on a file descriptor.  Each of these cases could have a
different variable or flag in (or hanging off) the task struct.  

In __mark_inode_dirty() we would first check to see if we are currently
in one of the plain, more atomic, mnt_want_write() regions by checking a
flag.  If not, we go looking through the task's file descriptors and
seeing if one of them is open for write on the inode.  If both of these
conditions fail, then we have a potential bug.  

-- Dave

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 00/25] Read-only bind mounts, Dave Hansen, (Thu Sep 20, 3:52 pm)
Re: [PATCH 24/25] r/o bind mounts: track number of mount wri..., Christoph Hellwig, (Mon Sep 24, 1:54 pm)
Re: [PATCH 24/25] r/o bind mounts: track number of mount wri..., Christoph Hellwig, (Mon Sep 24, 3:24 pm)
Re: [PATCH 24/25] r/o bind mounts: track number of mount wri..., Arjan van de Ven, (Mon Sep 24, 10:34 am)
[PATCH 25/25] honor r/w changes at do_remount() time, Dave Hansen, (Thu Sep 20, 3:53 pm)
[PATCH 23/25] do_rmdir(): elevate write count, Dave Hansen, (Thu Sep 20, 3:53 pm)
[PATCH 06/25] elevate write count open()'d files, Dave Hansen, (Thu Sep 20, 3:52 pm)
Re: [PATCH 06/25] elevate write count open()'d files, Andrew Morton, (Wed Nov 28, 4:41 am)
Re: [PATCH 06/25] elevate write count open()'d files, Dave Hansen, (Wed Nov 28, 1:33 pm)
[PATCH 19/25] elevate write count for do_utimes(), Dave Hansen, (Thu Sep 20, 3:53 pm)
[PATCH 02/25] rearrange may_open() to be r/o friendly, Dave Hansen, (Thu Sep 20, 3:52 pm)
[RFC] detect missed mnt_want_write() calls, Dave Hansen, (Tue Sep 25, 9:34 pm)
Re: [PATCH 07/25] r/o bind mounts: elevate write count for s..., Dave Hansen, (Fri Sep 21, 5:15 pm)
[PATCH 09/25] make access() use mnt check, Dave Hansen, (Thu Sep 20, 3:53 pm)
[PATCH 05/25] r/o bind mounts: stub functions, Dave Hansen, (Thu Sep 20, 3:52 pm)
[PATCH 04/25] create cleanup helper svc_msnfs(), Dave Hansen, (Thu Sep 20, 3:52 pm)
[PATCH 03/25] give may_open() a local 'mnt' variable, Dave Hansen, (Thu Sep 20, 3:52 pm)
Re: [PATCH 03/25] give may_open() a local 'mnt' variable, Christoph Hellwig, (Thu Sep 20, 3:57 pm)