nfsd4: preallocate nfs4_file in process_open1()
authorJ. Bruce Fields <bfields@redhat.com>
Thu, 13 Oct 2011 20:00:16 +0000 (16:00 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Mon, 17 Oct 2011 21:50:00 +0000 (17:50 -0400)
commit32513b40efdc693b3675f1c691ab901518fbcb6a
tree7d39ddbe4e421061f96d3dd5d64866b27117fd90
parentd29b20cd589128a599e5045d4effc2d7dbc388f5
nfsd4: preallocate nfs4_file in process_open1()

Creating a new file is an irrevocable step--once it's visible in the
filesystem, other processes may have seen it and done something with it,
and unlinking it wouldn't simply undo the effects of the create.

Therefore, in the case where OPEN creates a new file, we shouldn't do
the create until we know that the rest of the OPEN processing will
succeed.

For example, we should preallocate a struct file in case we need it
until waiting to allocate it till process_open2(), which is already too
late.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/nfs4state.c
fs/nfsd/xdr4.h