From: Matthew Treinish <treinish@linux.vnet.ibm.com>
To: linux-nfs@vger.kernel.org
Cc: treinish@linux.vnet.ibm.com
Subject: [PATCH/RFC v3 04/10] Store objects in nfs4_exception to be used during FHEXPIRED recovery.
Date: Mon, 5 Mar 2012 15:26:45 -0500 [thread overview]
Message-ID: <1330979211-894-5-git-send-email-treinish@linux.vnet.ibm.com> (raw)
In-Reply-To: <1330979211-894-1-git-send-email-treinish@linux.vnet.ibm.com>
To successfully recover an expired file handle we'll need either
an inode or preferably a dentry to enable us to recursively walk
back to the root of the export.
v3:
- Add support for getattr recovery by storing the file handle in
nfs4_exception.
v2:
- Added credential storage in the exception object. This will allow
switching credentials on an access error.
Signed-off-by: Matthew Treinish <treinish@linux.vnet.ibm.com>
---
fs/nfs/nfs4_fs.h | 4 ++
fs/nfs/nfs4proc.c | 122 ++++++++++++++++++++++++++++++++++++++++++----------
2 files changed, 102 insertions(+), 24 deletions(-)
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index b133b50..52d7f94 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -183,6 +183,10 @@ struct nfs4_exception {
long timeout;
int retry;
struct nfs4_state *state;
+ struct dentry *dentry;
+ struct inode *inode;
+ struct nfs_fh *fhandle;
+ struct rpc_cred *cred;
};
struct nfs4_state_recovery_ops {
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index ca5e3cd..3706c44 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -1260,7 +1260,10 @@ static int _nfs4_do_open_reclaim(struct nfs_open_context *ctx, struct nfs4_state
static int nfs4_do_open_reclaim(struct nfs_open_context *ctx, struct nfs4_state *state)
{
struct nfs_server *server = NFS_SERVER(state->inode);
- struct nfs4_exception exception = { };
+ struct nfs4_exception exception = {
+ .inode = state->inode,
+ .dentry = NULL,
+ };
int err;
do {
err = _nfs4_do_open_reclaim(ctx, state);
@@ -1302,7 +1305,10 @@ static int _nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs
int nfs4_open_delegation_recall(struct nfs_open_context *ctx, struct nfs4_state *state, const nfs4_stateid *stateid)
{
- struct nfs4_exception exception = { };
+ struct nfs4_exception exception = {
+ .inode = state->inode,
+ .dentry = NULL,
+ };
struct nfs_server *server = NFS_SERVER(state->inode);
int err;
do {
@@ -1692,7 +1698,10 @@ static int _nfs4_open_expired(struct nfs_open_context *ctx, struct nfs4_state *s
static int nfs4_do_open_expired(struct nfs_open_context *ctx, struct nfs4_state *state)
{
struct nfs_server *server = NFS_SERVER(state->inode);
- struct nfs4_exception exception = { };
+ struct nfs4_exception exception = {
+ .inode = state->inode,
+ .dentry = NULL,
+ };
int err;
do {
@@ -1839,7 +1848,11 @@ out_err:
static struct nfs4_state *nfs4_do_open(struct inode *dir, struct dentry *dentry, fmode_t fmode, int flags, struct iattr *sattr, struct rpc_cred *cred)
{
- struct nfs4_exception exception = { };
+ struct nfs4_exception exception = {
+ .dentry = dentry,
+ .inode = NULL,
+ .cred = cred,
+ };
struct nfs4_state *res;
int status;
@@ -1930,7 +1943,10 @@ static int nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred,
struct nfs4_state *state)
{
struct nfs_server *server = NFS_SERVER(inode);
- struct nfs4_exception exception = { };
+ struct nfs4_exception exception = {
+ .inode = inode,
+ .dentry = NULL,
+ };
int err;
do {
err = nfs4_handle_exception(server,
@@ -2400,7 +2416,10 @@ static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle,
static int nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr)
{
- struct nfs4_exception exception = { };
+ struct nfs4_exception exception = {
+ .fhandle = fhandle,
+ .dentry = NULL,
+ };
int err;
do {
err = nfs4_handle_exception(server,
@@ -2505,7 +2524,10 @@ void nfs_fixup_secinfo_attributes(struct nfs_fattr *fattr, struct nfs_fh *fh)
static int nfs4_proc_lookup(struct rpc_clnt *clnt, struct inode *dir, struct qstr *name,
struct nfs_fh *fhandle, struct nfs_fattr *fattr)
{
- struct nfs4_exception exception = { };
+ struct nfs4_exception exception = {
+ .inode = dir,
+ .dentry = NULL,
+ };
int err;
do {
int status;
@@ -2582,7 +2604,11 @@ static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry
static int nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry)
{
- struct nfs4_exception exception = { };
+ struct nfs4_exception exception = {
+ .inode = inode,
+ .dentry = NULL,
+ .cred = entry->cred,
+ };
int err;
do {
err = nfs4_handle_exception(NFS_SERVER(inode),
@@ -2638,7 +2664,10 @@ static int _nfs4_proc_readlink(struct inode *inode, struct page *page,
static int nfs4_proc_readlink(struct inode *inode, struct page *page,
unsigned int pgbase, unsigned int pglen)
{
- struct nfs4_exception exception = { };
+ struct nfs4_exception exception = {
+ .inode = inode,
+ .dentry = NULL,
+ };
int err;
do {
err = nfs4_handle_exception(NFS_SERVER(inode),
@@ -2730,7 +2759,10 @@ out:
static int nfs4_proc_remove(struct inode *dir, struct qstr *name)
{
- struct nfs4_exception exception = { };
+ struct nfs4_exception exception = {
+ .inode = dir,
+ .dentry = NULL,
+ };
int err;
do {
err = nfs4_handle_exception(NFS_SERVER(dir),
@@ -2885,7 +2917,10 @@ out:
static int nfs4_proc_link(struct inode *inode, struct inode *dir, struct qstr *name)
{
- struct nfs4_exception exception = { };
+ struct nfs4_exception exception = {
+ .inode = inode,
+ .dentry = NULL,
+ };
int err;
do {
err = nfs4_handle_exception(NFS_SERVER(inode),
@@ -2977,7 +3012,10 @@ out:
static int nfs4_proc_symlink(struct inode *dir, struct dentry *dentry,
struct page *page, unsigned int len, struct iattr *sattr)
{
- struct nfs4_exception exception = { };
+ struct nfs4_exception exception = {
+ .dentry = dentry,
+ .inode = NULL,
+ };
int err;
do {
err = nfs4_handle_exception(NFS_SERVER(dir),
@@ -3008,7 +3046,10 @@ out:
static int nfs4_proc_mkdir(struct inode *dir, struct dentry *dentry,
struct iattr *sattr)
{
- struct nfs4_exception exception = { };
+ struct nfs4_exception exception = {
+ .dentry = dentry,
+ .inode = NULL,
+ };
int err;
sattr->ia_mode &= ~current_umask();
@@ -3062,7 +3103,10 @@ static int _nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
static int nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred,
u64 cookie, struct page **pages, unsigned int count, int plus)
{
- struct nfs4_exception exception = { };
+ struct nfs4_exception exception = {
+ .dentry = dentry,
+ .inode = NULL,
+ };
int err;
do {
err = nfs4_handle_exception(NFS_SERVER(dentry->d_inode),
@@ -3110,7 +3154,10 @@ out:
static int nfs4_proc_mknod(struct inode *dir, struct dentry *dentry,
struct iattr *sattr, dev_t rdev)
{
- struct nfs4_exception exception = { };
+ struct nfs4_exception exception = {
+ .dentry = dentry,
+ .inode = NULL,
+ };
int err;
sattr->ia_mode &= ~current_umask();
@@ -3659,7 +3706,10 @@ out_free:
static ssize_t nfs4_get_acl_uncached(struct inode *inode, void *buf, size_t buflen)
{
- struct nfs4_exception exception = { };
+ struct nfs4_exception exception = {
+ .inode = inode,
+ .dentry = NULL,
+ };
ssize_t ret;
do {
ret = __nfs4_get_acl_uncached(inode, buf, buflen);
@@ -3736,7 +3786,10 @@ static int __nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t bufl
static int nfs4_proc_set_acl(struct inode *inode, const void *buf, size_t buflen)
{
- struct nfs4_exception exception = { };
+ struct nfs4_exception exception = {
+ .inode = inode,
+ .dentry = NULL,
+ };
int err;
do {
err = nfs4_handle_exception(NFS_SERVER(inode),
@@ -4000,7 +4053,10 @@ out:
int nfs4_proc_delegreturn(struct inode *inode, struct rpc_cred *cred, const nfs4_stateid *stateid, int issync)
{
struct nfs_server *server = NFS_SERVER(inode);
- struct nfs4_exception exception = { };
+ struct nfs4_exception exception = {
+ .inode = inode,
+ .dentry = NULL,
+ };
int err;
do {
err = _nfs4_proc_delegreturn(inode, cred, stateid, issync);
@@ -4074,7 +4130,10 @@ out:
static int nfs4_proc_getlk(struct nfs4_state *state, int cmd, struct file_lock *request)
{
- struct nfs4_exception exception = { };
+ struct nfs4_exception exception = {
+ .inode = state->inode,
+ .dentry = NULL,
+ };
int err;
do {
@@ -4480,7 +4539,10 @@ static int _nfs4_do_setlk(struct nfs4_state *state, int cmd, struct file_lock *f
static int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request)
{
struct nfs_server *server = NFS_SERVER(state->inode);
- struct nfs4_exception exception = { };
+ struct nfs4_exception exception = {
+ .inode = state->inode,
+ .dentry = NULL,
+ };
int err;
do {
@@ -4498,7 +4560,10 @@ static int nfs4_lock_reclaim(struct nfs4_state *state, struct file_lock *request
static int nfs4_lock_expired(struct nfs4_state *state, struct file_lock *request)
{
struct nfs_server *server = NFS_SERVER(state->inode);
- struct nfs4_exception exception = { };
+ struct nfs4_exception exception = {
+ .inode = state->inode,
+ .dentry = NULL,
+ };
int err;
err = nfs4_set_lock_state(state, request);
@@ -4596,7 +4661,10 @@ out:
static int nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock *request)
{
- struct nfs4_exception exception = { };
+ struct nfs4_exception exception = {
+ .inode = state->inode,
+ .dentry = NULL,
+ };
int err;
do {
@@ -4656,7 +4724,10 @@ nfs4_proc_lock(struct file *filp, int cmd, struct file_lock *request)
int nfs4_lock_delegation_recall(struct nfs4_state *state, struct file_lock *fl)
{
struct nfs_server *server = NFS_SERVER(state->inode);
- struct nfs4_exception exception = { };
+ struct nfs4_exception exception = {
+ .inode = state->inode,
+ .dentry = NULL,
+ };
int err;
err = nfs4_set_lock_state(state, fl);
@@ -4863,7 +4934,10 @@ static int _nfs4_proc_secinfo(struct inode *dir, const struct qstr *name, struct
int nfs4_proc_secinfo(struct inode *dir, const struct qstr *name, struct nfs4_secinfo_flavors *flavors)
{
- struct nfs4_exception exception = { };
+ struct nfs4_exception exception = {
+ .inode = dir,
+ .dentry = NULL,
+ };
int err;
do {
err = nfs4_handle_exception(NFS_SERVER(dir),
--
1.7.4.4
next prev parent reply other threads:[~2012-03-05 20:28 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-05 20:26 [PATCH/RFC v3 00/10] Volatile File Handle Client-side Support Matthew Treinish
2012-03-05 20:26 ` [PATCH/RFC v3 01/10] Add support for FH_EXPIRE_TYPE attribute Matthew Treinish
2012-03-05 20:26 ` [PATCH/RFC v3 02/10] Save root file handle in nfs_server Matthew Treinish
2012-03-05 20:26 ` [PATCH/RFC v3 03/10] Store root dentry in server object Matthew Treinish
2012-03-05 20:26 ` Matthew Treinish [this message]
2012-03-05 20:26 ` [PATCH/RFC v3 05/10] Add nfs4_vfh_getdentry() for getattr recovery Matthew Treinish
2012-03-05 20:26 ` [PATCH/RFC v3 06/10] Add VFH FHEXPIRED recovery functions Matthew Treinish
2012-03-05 20:26 ` [PATCH/RFC v3 07/10] Perform recovery on both inodes for rename Matthew Treinish
2012-03-05 20:26 ` [PATCH/RFC v3 08/10] Added error handling for NFS4ERR_FHEXPIRED Matthew Treinish
2012-03-05 20:26 ` [PATCH/RFC v3 09/10] VFH recovery from a replication/migration event Matthew Treinish
2012-03-05 20:26 ` [PATCH/RFC v3 10/10] New mount option for volatile filehandle recovery Matthew Treinish
2012-03-13 17:33 ` [PATCH/RFC v3 00/10] Volatile File Handle Client-side Support Matthew Treinish
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=1330979211-894-5-git-send-email-treinish@linux.vnet.ibm.com \
--to=treinish@linux.vnet.ibm.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).