From: NeilBrown <neilb@suse.com>
To: Linux NFS Mailing List <linux-nfs@vger.kernel.org>
Subject: Incorrect(?) use of open_state->stateid in pnfs
Date: Thu, 13 Oct 2016 18:18:04 +1100 [thread overview]
Message-ID: <87zim8zphv.fsf@notabene.neil.brown.name> (raw)
[-- Attachment #1: Type: text/plain, Size: 1613 bytes --]
Suppose I open/create a file over pNFS and am given a WRITE delegation.
I then chmod the file (as rsync is wont to do) so the delegation is
immediately returned.
I then proceed to write, which triggers a LAYOUT_GET request. The
stateid for that request it taken from state->stateid, which is still
the delegation stateid. Naturally it gets NFS4ERR_BAD_STATEID.
When an OPEN is given a delegation, the delegation stateid gets copied
into ->stateid and the open stateid is left in ->open_stateid.
When the delegation is returned, this it done by inode, not open_state,
so it doesn't have easy access to reset the ->stateid. It could find
all the open_states and fix them up I guess it ....
Other than this usage in pnfs (which dates back to commit b1f69b754e and
is, I believe, incorrect) the ->stateid is *only* used to help find the
write state to recover when an error is reported and the state needs to
be recovered (... though the usage in nfs4_do_handle_exception()
introduced by 272289a3df is a bit different).
Anyway, no other code uses it when choosing a stateid to send in a
request. So no other code inadvertently uses the delegation stateid
after it has been returned.
How should this be fixed?
- have nfs_start_delegation_return() iterated over all open states
and copy the open_stateid over the stateid??
- have pnfs_update_layout() use ->open_stateid rather than ->stateid ??
I suspect that would be wrong.
- have pnfs_update_layout() use ->open_stateid if NFS_I()->delegation
is NULL ??
Something else?
The last seems easiest, but I'm not certain it is best.
Thanks,
NeilBrown
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 800 bytes --]
next reply other threads:[~2016-10-13 7:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-13 7:18 NeilBrown [this message]
2016-10-13 13:08 ` Incorrect(?) use of open_state->stateid in pnfs Trond Myklebust
2016-10-13 21:55 ` NeilBrown
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=87zim8zphv.fsf@notabene.neil.brown.name \
--to=neilb@suse.com \
--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;
as well as URLs for NNTP newsgroup(s).