Linux NFS development
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.de>
To: "J. Bruce Fields" <bfields@fieldses.org>
Cc: NFS <linux-nfs@vger.kernel.org>
Subject: Does NFSv4 need to call inode_permission on every write???
Date: Thu, 21 May 2015 14:40:29 +1000	[thread overview]
Message-ID: <20150521144029.57f1b33f@notabene.brown> (raw)

[-- Attachment #1: Type: text/plain, Size: 1117 bytes --]



Apologies if this has been answered before, however...

In nfsd_write() we have:

	if (file) {
		err = nfsd_permission(rqstp, fhp->fh_export, fhp->fh_dentry,
				NFSD_MAY_WRITE|NFSD_MAY_OWNER_OVERRIDE);
		if (err)
			goto out;
		err = nfsd_vfs_write(rqstp, fhp, file, offset, vec, vlen, cnt,
				stablep);
	} else {

So if a 'file' is already available - because the request came via NFSv4 and
there was a valid state id, and a 'struct file' was associated with that
state - we still call nfsd_permission().

Is that really needed?  The permission check will have been performed at open
- it shouldn't be needed again now.

With NFSv3 we have to check permission at each IO, and this is slightly
different from POSIX semantics.  We shouldn't have to with NFSv4... should we?

The particular issue that brought this to my attention is that "chattr +i" -
to make a file immutable - is not supposed to affect current opens, only
future opens.  But a current open over NFSv4 is affected.

Is there some reason that we cannot just remove that nfsd_permission() check?

Thanks,
NeilBrown

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

             reply	other threads:[~2015-05-21  4:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-21  4:40 NeilBrown [this message]
2015-05-21 13:07 ` Does NFSv4 need to call inode_permission on every write??? J. Bruce Fields
2015-05-21 13:23   ` Boaz Harrosh
2015-05-21 23:01   ` NeilBrown
2015-05-22 16:16     ` J. Bruce Fields
2015-05-23 13:37 ` Jeff Layton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150521144029.57f1b33f@notabene.brown \
    --to=neilb@suse.de \
    --cc=bfields@fieldses.org \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox