提交 2336745e 编写于 作者: K Kinglong Mee 提交者: J. Bruce Fields

NFSD: Clear wcc data between compound ops

Testing NFS4.0 by pynfs, I got some messeages as,
"nfsd: inode locked twice during operation."

When one compound RPC contains two or more ops that locks
the filehandle,the second op will cause the message.

As two SETATTR ops, after the first SETATTR, nfsd will not call
fh_put() to release current filehandle, it means filehandle have
unlocked with fh_post_saved = 1.
The second SETATTR find fh_post_saved = 1, and printk the message.

v2: introduce helper fh_clear_wcc().
Signed-off-by: NKinglong Mee <kinglongmee@gmail.com>
Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
上级 a8a7c677
...@@ -1358,6 +1358,8 @@ nfsd4_proc_compound(struct svc_rqst *rqstp, ...@@ -1358,6 +1358,8 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
goto encode_op; goto encode_op;
} }
fh_clear_wcc(current_fh);
/* If op is non-idempotent */ /* If op is non-idempotent */
if (opdesc->op_flags & OP_MODIFIES_SOMETHING) { if (opdesc->op_flags & OP_MODIFIES_SOMETHING) {
plen = opdesc->op_rsize_bop(rqstp, op); plen = opdesc->op_rsize_bop(rqstp, op);
......
...@@ -132,6 +132,17 @@ fh_init(struct svc_fh *fhp, int maxsize) ...@@ -132,6 +132,17 @@ fh_init(struct svc_fh *fhp, int maxsize)
} }
#ifdef CONFIG_NFSD_V3 #ifdef CONFIG_NFSD_V3
/*
* The wcc data stored in current_fh should be cleared
* between compound ops.
*/
static inline void
fh_clear_wcc(struct svc_fh *fhp)
{
fhp->fh_post_saved = 0;
fhp->fh_pre_saved = 0;
}
/* /*
* Fill in the pre_op attr for the wcc data * Fill in the pre_op attr for the wcc data
*/ */
...@@ -152,7 +163,8 @@ fill_pre_wcc(struct svc_fh *fhp) ...@@ -152,7 +163,8 @@ fill_pre_wcc(struct svc_fh *fhp)
extern void fill_post_wcc(struct svc_fh *); extern void fill_post_wcc(struct svc_fh *);
#else #else
#define fill_pre_wcc(ignored) #define fh_clear_wcc(ignored)
#define fill_pre_wcc(ignored)
#define fill_post_wcc(notused) #define fill_post_wcc(notused)
#endif /* CONFIG_NFSD_V3 */ #endif /* CONFIG_NFSD_V3 */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册