2005-01-21 17:55:20

by Aaron D. Ball

[permalink] [raw]
Subject: append-only attribute support

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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs


2005-01-21 18:02:51

by Trond Myklebust

[permalink] [raw]
Subject: Re: append-only attribute support

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 <[email protected]>



-------------------------------------------------------
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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

2005-01-21 18:11:46

by Aaron D. Ball

[permalink] [raw]
Subject: Re: append-only attribute support

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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs

2005-01-24 04:27:53

by NeilBrown

[permalink] [raw]
Subject: Re: append-only attribute support

On Friday January 21, [email protected] 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 - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs