All of lore.kernel.org
 help / color / mirror / Atom feed
* knfsd and append-only attribute:  "operation not permitted"
@ 2005-01-20 18:45 Aaron D. Ball
  2005-01-21 14:44 ` Vladimir Saveliev
  0 siblings, 1 reply; 9+ messages in thread
From: Aaron D. Ball @ 2005-01-20 18:45 UTC (permalink / raw)
  To: reiserfs-list

When I use the kernel-based NFS server to export directories on 
ReiserFS that have the append-only attribute set, I can't access the 
files from the client machines at all:  for example, "ls" returns 
"operation not permitted".  Is this a known bug?  Is there a good 
workaround?

I'm running up-to-date Debian sid with Linux 2.6.10 compiled from the 
stock Debian kernel-source package.  Everything works fine in other 
contexts, such as

* direct access on the server
* access via Samba
* access via the userspace NFS server (which I'm using as a workaround 
for now)

I'd really like to get things working with the kernel-based server so I 
can have locks.  Abandoning extended attributes would mean I have to 
monitor certain files and directories for changes and check them after 
the fact rather than simply blocking all the changes I don't want.  Is 
there hope?  Am I just doing something dumb?


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

* Re: knfsd and append-only attribute:  "operation not permitted"
  2005-01-20 18:45 knfsd and append-only attribute: "operation not permitted" Aaron D. Ball
@ 2005-01-21 14:44 ` Vladimir Saveliev
  2005-01-21 15:53   ` Trond Myklebust
  0 siblings, 1 reply; 9+ messages in thread
From: Vladimir Saveliev @ 2005-01-21 14:44 UTC (permalink / raw)
  To: Aaron D.Ball; +Cc: reiserfs-list, linux-kernel@vger.kernel.org

Hello

On Thu, 2005-01-20 at 21:45, Aaron D.Ball wrote:
> When I use the kernel-based NFS server to export directories on 
> ReiserFS that have the append-only attribute set, I can't access the 
> files from the client machines at all:  for example, "ls" returns 
> "operation not permitted".  Is this a known bug?  Is there a good 
> workaround?
> 

It looks like the problem is not in reiserfs, but in nfsd.
fs/nfsd/vfs.c:nfsd_open() refuses to open append only files.

	/* Disallow access to files with the append-only bit set or
	 * with mandatory locking enabled
	 */
	err = nfserr_perm;
	if (IS_APPEND(inode) || IS_ISMNDLK(inode))
		goto out;


> I'm running up-to-date Debian sid with Linux 2.6.10 compiled from the 
> stock Debian kernel-source package.  Everything works fine in other 
> contexts, such as
> 
> * direct access on the server
> * access via Samba
> * access via the userspace NFS server (which I'm using as a workaround 
> for now)
> 
> I'd really like to get things working with the kernel-based server so I 
> can have locks.  Abandoning extended attributes would mean I have to 
> monitor certain files and directories for changes and check them after 
> the fact rather than simply blocking all the changes I don't want.  Is 
> there hope?  Am I just doing something dumb?
> 
> 


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

* Re: knfsd and append-only attribute:  "operation not permitted"
  2005-01-21 14:44 ` Vladimir Saveliev
@ 2005-01-21 15:53   ` Trond Myklebust
  2005-01-21 16:23     ` Aaron D. Ball
  0 siblings, 1 reply; 9+ messages in thread
From: Trond Myklebust @ 2005-01-21 15:53 UTC (permalink / raw)
  To: Vladimir Saveliev
  Cc: Aaron D.Ball, reiserfs-list, linux-kernel@vger.kernel.org

fr den 21.01.2005 Klokka 17:44 (+0300) skreiv Vladimir Saveliev:
> Hello
> 
> On Thu, 2005-01-20 at 21:45, Aaron D.Ball wrote:
> > When I use the kernel-based NFS server to export directories on 
> > ReiserFS that have the append-only attribute set, I can't access the 
> > files from the client machines at all:  for example, "ls" returns 
> > "operation not permitted".  Is this a known bug?  Is there a good 
> > workaround?
> > 
> 
> It looks like the problem is not in reiserfs, but in nfsd.
> fs/nfsd/vfs.c:nfsd_open() refuses to open append only files.

Append-only is an unsupported concept in the all existing revisions of
the NFS protocol. In fact, NFS has no support for append writes at all:
they have to be emulated by the clients.

Cheers,
  Trond

-- 
Trond Myklebust <trond.myklebust@fys.uio.no>


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

* Re: knfsd and append-only attribute:  "operation not permitted"
  2005-01-21 15:53   ` Trond Myklebust
@ 2005-01-21 16:23     ` Aaron D. Ball
  2005-01-21 17:08       ` Trond Myklebust
  0 siblings, 1 reply; 9+ messages in thread
From: Aaron D. Ball @ 2005-01-21 16:23 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: Vladimir Saveliev, linux-kernel@vger.kernel.org

Trond Myklebust wrote:

>fr den 21.01.2005 Klokka 17:44 (+0300) skreiv Vladimir Saveliev:
>  
>
>> fs/nfsd/vfs.c:nfsd_open() refuses to open append only files.
>
>
>Append-only is an unsupported concept in the all existing revisions of
>the NFS protocol. In fact, NFS has no support for append writes at all:
>they have to be emulated by the clients.
>  
>
OK, but that certainly shouldn't preclude read access.  The way it is 
now, you can't even list append-only directories.  It seems like this 
check should treat append-only files as read-only, only failing to open 
them if write access is requested, rather than failing all the time like 
it does now.

In this particular case, I'm not using append-only files, but rather 
using immutable files and append-only directories to create an archival 
space where things can be added but not changed.  Even if the protocol 
can't deal with append-only regular files, isn't it possible to allow 
mkdir but not rmdir?


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

* Re: knfsd and append-only attribute:  "operation not permitted"
  2005-01-21 16:23     ` Aaron D. Ball
@ 2005-01-21 17:08       ` Trond Myklebust
  2005-01-21 17:56         ` append-only attribute support Aaron D. Ball
  0 siblings, 1 reply; 9+ messages in thread
From: Trond Myklebust @ 2005-01-21 17:08 UTC (permalink / raw)
  To: Aaron D. Ball; +Cc: Vladimir Saveliev, linux-kernel@vger.kernel.org

fr den 21.01.2005 Klokka 11:23 (-0500) skreiv Aaron D. Ball:

> OK, but that certainly shouldn't preclude read access.  The way it is 
> now, you can't even list append-only directories.  It seems like this 
> check should treat append-only files as read-only, only failing to open 
> them if write access is requested, rather than failing all the time like 
> it does now.

Agreed.

> In this particular case, I'm not using append-only files, but rather 
> using immutable files and append-only directories to create an archival 
> space where things can be added but not changed.  Even if the protocol 
> can't deal with append-only regular files, isn't it possible to allow 
> mkdir but not rmdir?

Append-only directories should be no problem as far as the protocol
goes, and neither should immutable files.

I suggest you take this bug to the NFS mailing list
nfs@lists.sourceforge.net or talk directly to the knfsd maintainer Neil
Brown (neilb@cse.unsw.edu.au).

Cheers,
  Trond

-- 
Trond Myklebust <trond.myklebust@fys.uio.no>


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

* append-only attribute support
  2005-01-21 17:08       ` Trond Myklebust
@ 2005-01-21 17:56         ` Aaron D. Ball
  2005-01-21 18:02           ` Trond Myklebust
  0 siblings, 1 reply; 9+ messages in thread
From: Aaron D. Ball @ 2005-01-21 17:56 UTC (permalink / raw)
  To: nfs

knfsd as of Linux 2.6.10 refuses to have anything to do with files or 
directories with the append-only attribute set:  not even read 
operations are allowed.  While I understand that NFS doesn't support the 
idea of appending to files, it seems like there should at least be read 
and mkdir support for append-only files and directories, and that this 
could be implemented with a couple small changes to the logic of 
fs/nfsd/vfs.c.

Does that seem reasonable?  Is it likely to happen soon?  Should I try 
to work up a patch?

Though I haven't tested this, it looks like a one-line fix at first glance:

--- vfs.c~      2004-12-24 16:34:31.000000000 -0500
+++ vfs.c       2005-01-21 12:52:14.000000000 -0500
@@ -658,7 +658,7 @@
         * with mandatory locking enabled
         */
        err = nfserr_perm;
-       if (IS_APPEND(inode) || IS_ISMNDLK(inode))
+       if ((IS_APPEND(inode) || (access & MAY_WRITE)) || 
IS_ISMNDLK(inode))
                goto out;
        if (!inode->i_fop)
                goto out;



-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

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

* Re: append-only attribute support
  2005-01-21 17:56         ` append-only attribute support Aaron D. Ball
@ 2005-01-21 18:02           ` Trond Myklebust
  2005-01-21 18:12             ` Aaron D. Ball
  0 siblings, 1 reply; 9+ messages in thread
From: Trond Myklebust @ 2005-01-21 18:02 UTC (permalink / raw)
  To: Aaron D. Ball; +Cc: nfs

fr den 21.01.2005 Klokka 12:56 (-0500) skreiv Aaron D. Ball:

> --- vfs.c~      2004-12-24 16:34:31.000000000 -0500
> +++ vfs.c       2005-01-21 12:52:14.000000000 -0500
> @@ -658,7 +658,7 @@
>          * with mandatory locking enabled
>          */
>         err = nfserr_perm;
> -       if (IS_APPEND(inode) || IS_ISMNDLK(inode))
> +       if ((IS_APPEND(inode) || (access & MAY_WRITE)) || 
> IS_ISMNDLK(inode))
>                 goto out;
>         if (!inode->i_fop)
>                 goto out;

Don't you mean

	if ((IS_APPEND(inode) && (access & MAY_WRITE)) || IS_ISMNDLK(inode))

;-)

Cheers,
  Trond

-- 
Trond Myklebust <trond.myklebust@fys.uio.no>



-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

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

* Re: append-only attribute support
  2005-01-21 18:02           ` Trond Myklebust
@ 2005-01-21 18:12             ` Aaron D. Ball
  2005-01-24  4:27               ` Neil Brown
  0 siblings, 1 reply; 9+ messages in thread
From: Aaron D. Ball @ 2005-01-21 18:12 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: nfs

Trond Myklebust wrote:

> Don't you mean
>
>	if ((IS_APPEND(inode) && (access & MAY_WRITE)) || IS_ISMNDLK(inode))
>
>;-)
>  
>
Yep, I retyped it without my brain engaged.  Guess 1 PM is past my bedtime.

It'll be a few hours before I can try this out.  Does anything else 
suggest itself in the mean time?


-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

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

* Re: append-only attribute support
  2005-01-21 18:12             ` Aaron D. Ball
@ 2005-01-24  4:27               ` Neil Brown
  0 siblings, 0 replies; 9+ messages in thread
From: Neil Brown @ 2005-01-24  4:27 UTC (permalink / raw)
  To: Aaron D. Ball; +Cc: Trond Myklebust, nfs

On Friday January 21, adb@bdi.com wrote:
> Trond Myklebust wrote:
> 
> > Don't you mean
> >
> >	if ((IS_APPEND(inode) && (access & MAY_WRITE)) || IS_ISMNDLK(inode))
> >
> >;-)
> >  
> >
> Yep, I retyped it without my brain engaged.  Guess 1 PM is past my bedtime.
> 
> It'll be a few hours before I can try this out.  Does anything else 
> suggest itself in the mean time?

Sounds sensible. I'll forward the following patch off in due course.

NeilBrown


 ----------- Diffstat output ------------
 ./fs/nfsd/vfs.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff ./fs/nfsd/vfs.c~current~ ./fs/nfsd/vfs.c
--- ./fs/nfsd/vfs.c~current~	2005-01-24 15:25:31.000000000 +1100
+++ ./fs/nfsd/vfs.c	2005-01-24 15:26:39.000000000 +1100
@@ -656,12 +656,15 @@ nfsd_open(struct svc_rqst *rqstp, struct
 	dentry = fhp->fh_dentry;
 	inode = dentry->d_inode;
 
-	/* Disallow access to files with the append-only bit set or
-	 * with mandatory locking enabled
+	/* Disallow write access to files with the append-only bit set
+	 * or any access when mandatory locking enabled
 	 */
 	err = nfserr_perm;
-	if (IS_APPEND(inode) || IS_ISMNDLK(inode))
+	if (IS_APPEND(inode) && (access & MAY_WRITE))
 		goto out;
+	if (IS_ISMNDLK(inode))
+		goto out;
+
 	if (!inode->i_fop)
 		goto out;
 


-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
NFS maillist  -  NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs

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

end of thread, other threads:[~2005-01-24  4:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-20 18:45 knfsd and append-only attribute: "operation not permitted" Aaron D. Ball
2005-01-21 14:44 ` Vladimir Saveliev
2005-01-21 15:53   ` Trond Myklebust
2005-01-21 16:23     ` Aaron D. Ball
2005-01-21 17:08       ` Trond Myklebust
2005-01-21 17:56         ` append-only attribute support Aaron D. Ball
2005-01-21 18:02           ` Trond Myklebust
2005-01-21 18:12             ` Aaron D. Ball
2005-01-24  4:27               ` Neil Brown

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.