linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: "r/o bind mounts" patch in 2.6.26-rc6 changes (breaks?) error behaviour
       [not found] <485B8361.6010708@LiPPERTEmbedded.de>
@ 2008-06-20 14:17 ` Dave Hansen
  2008-06-20 15:28   ` Dave Hansen
  2008-06-24 18:21   ` Pavel Machek
  0 siblings, 2 replies; 4+ messages in thread
From: Dave Hansen @ 2008-06-20 14:17 UTC (permalink / raw)
  To: Jens Rottmann; +Cc: Al Viro, linux-fsdevel, linux-kernel@vger.kernel.org

On Fri, 2008-06-20 at 12:16 +0200, Jens Rottmann wrote:
> 
> I noticed the following change in the error behaviour when attempting
> to delete nonexisting files/dirs from R/O-mounted directories:
> 
> Linux 2.6.25.7:
> rm /RO_mounted_path/nonexisting_file
> ==> "No such file or directory"
> 
> Linux 2.6.26-rc6-git6:
> rm /RO_mounted_path/nonexisting_file
> ==> "Read-only file system"

We looked at this way back in the beginning when I started to work on
the patches.  It was decided that the error codes weren't horribly
important.  We did have a case a bit ago where it really mattered, and
Al fixed that up.

I know this changed behavior a bit, but userspace can surely work around
it with read-only operations (stat) when it is really important to get
the error to the user just right.

> @@ -2371,8 +2373,10 @@ static long do_unlinkat(int dfd, const c
>                 if (inode)
>                         atomic_inc(&inode->i_count);
>                 error = mnt_want_write(nd.path.mnt);
> -               if (error)
> +               if (error) {
> +                       error = vfs_unlink(nd.path.dentry->d_inode, dentry);
>                         goto exit2;
> +               }
>                 error = vfs_unlink(nd.path.dentry->d_inode, dentry);
>                 mnt_drop_write(nd.path.mnt);

On a r/w fs where this is being performed on a r/o bind mount, this will
let you unlink files.  I think that's bad.  :)

-- Dave


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: "r/o bind mounts" patch in 2.6.26-rc6 changes (breaks?) error behaviour
  2008-06-20 14:17 ` "r/o bind mounts" patch in 2.6.26-rc6 changes (breaks?) error behaviour Dave Hansen
@ 2008-06-20 15:28   ` Dave Hansen
  2008-06-20 16:14     ` Jens Rottmann
  2008-06-24 18:21   ` Pavel Machek
  1 sibling, 1 reply; 4+ messages in thread
From: Dave Hansen @ 2008-06-20 15:28 UTC (permalink / raw)
  To: Jens Rottmann; +Cc: Al Viro, linux-fsdevel, linux-kernel@vger.kernel.org

On Fri, 2008-06-20 at 07:17 -0700, Dave Hansen wrote:
> On Fri, 2008-06-20 at 12:16 +0200, Jens Rottmann wrote:
> > 
> > I noticed the following change in the error behaviour when attempting
> > to delete nonexisting files/dirs from R/O-mounted directories:
> > 
> > Linux 2.6.25.7:
> > rm /RO_mounted_path/nonexisting_file
> > ==> "No such file or directory"
> > 
> > Linux 2.6.26-rc6-git6:
> > rm /RO_mounted_path/nonexisting_file
> > ==> "Read-only file system"
> 
> We looked at this way back in the beginning when I started to work on
> the patches.  It was decided that the error codes weren't horribly
> important.  We did have a case a bit ago where it really mattered, and
> Al fixed that up.
> 
> I know this changed behavior a bit, but userspace can surely work around
> it with read-only operations (stat) when it is really important to get
> the error to the user just right.

Also, there are some nice benefits to the new way of doing it.  To
figure out if there is a file in that location also requires a path
walk.  Now, that isn't the most expensive thing in the world, but it is
a heck of a lot more expensive than just doing a read-only look at a
variable in the mount (in mnt_want_write()).

Don't you *want* warnings when an 'rm -f' runs into a r/o filesystem? ;)

-- Dave


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: "r/o bind mounts" patch in 2.6.26-rc6 changes (breaks?) error behaviour
  2008-06-20 15:28   ` Dave Hansen
@ 2008-06-20 16:14     ` Jens Rottmann
  0 siblings, 0 replies; 4+ messages in thread
From: Jens Rottmann @ 2008-06-20 16:14 UTC (permalink / raw)
  To: Dave Hansen; +Cc: Al Viro, linux-fsdevel, linux-kernel@vger.kernel.org

Dave Hansen wrote:
> ... requires a path walk ...

... which is spared only in the error path, the normal path still does the path walk anyway.

> Don't you *want* warnings when an 'rm -f' runs into a r/o filesystem? ;)

Well, not really. The "rm -f"s are in my startup scripts, supposed to delete stale lock files and lots of stuff that's usually not there unless something went wrong the last time. But most of the time, I leave the whole system mounted R/O, except some tmpfs, dead useful for kernel/hardware hacking/testing.
But now I get masses of error messages on bootup - guess I have to litter the scripts with "if [ -e ... ]; then"s or just live with it.  :-|

Anyway, thanks for solving this mystery for me.  :-)

Jens

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: "r/o bind mounts" patch in 2.6.26-rc6 changes (breaks?) error behaviour
  2008-06-20 14:17 ` "r/o bind mounts" patch in 2.6.26-rc6 changes (breaks?) error behaviour Dave Hansen
  2008-06-20 15:28   ` Dave Hansen
@ 2008-06-24 18:21   ` Pavel Machek
  1 sibling, 0 replies; 4+ messages in thread
From: Pavel Machek @ 2008-06-24 18:21 UTC (permalink / raw)
  To: Dave Hansen
  Cc: Jens Rottmann, Al Viro, linux-fsdevel,
	linux-kernel@vger.kernel.org

On Fri 2008-06-20 07:17:46, Dave Hansen wrote:
> On Fri, 2008-06-20 at 12:16 +0200, Jens Rottmann wrote:
> > 
> > I noticed the following change in the error behaviour when attempting
> > to delete nonexisting files/dirs from R/O-mounted directories:
> > 
> > Linux 2.6.25.7:
> > rm /RO_mounted_path/nonexisting_file
> > ==> "No such file or directory"
> > 
> > Linux 2.6.26-rc6-git6:
> > rm /RO_mounted_path/nonexisting_file
> > ==> "Read-only file system"
> 
> We looked at this way back in the beginning when I started to work on
> the patches.  It was decided that the error codes weren't horribly
> important.  We did have a case a bit ago where it really mattered, and
> Al fixed that up.
> 
> I know this changed behavior a bit, but userspace can surely work around
> it with read-only operations (stat) when it is really important to get
> the error to the user just right.

I'd say userspace should not have to work around this.

Interface change, in stable series, w/o deprecation period, new
interface is worse than the old one...

						Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-06-26  8:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <485B8361.6010708@LiPPERTEmbedded.de>
2008-06-20 14:17 ` "r/o bind mounts" patch in 2.6.26-rc6 changes (breaks?) error behaviour Dave Hansen
2008-06-20 15:28   ` Dave Hansen
2008-06-20 16:14     ` Jens Rottmann
2008-06-24 18:21   ` Pavel Machek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).