|
@@ -713,16 +713,23 @@ EXPORT_SYMBOL_GPL(put_nfs_open_context);
|
|
|
* Ensure that mmap has a recent RPC credential for use when writing out
|
|
|
* shared pages
|
|
|
*/
|
|
|
-void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx)
|
|
|
+void nfs_inode_attach_open_context(struct nfs_open_context *ctx)
|
|
|
{
|
|
|
- struct inode *inode = file_inode(filp);
|
|
|
+ struct inode *inode = ctx->dentry->d_inode;
|
|
|
struct nfs_inode *nfsi = NFS_I(inode);
|
|
|
|
|
|
- filp->private_data = get_nfs_open_context(ctx);
|
|
|
spin_lock(&inode->i_lock);
|
|
|
list_add(&ctx->list, &nfsi->open_files);
|
|
|
spin_unlock(&inode->i_lock);
|
|
|
}
|
|
|
+EXPORT_SYMBOL_GPL(nfs_inode_attach_open_context);
|
|
|
+
|
|
|
+void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx)
|
|
|
+{
|
|
|
+ filp->private_data = get_nfs_open_context(ctx);
|
|
|
+ if (list_empty(&ctx->list))
|
|
|
+ nfs_inode_attach_open_context(ctx);
|
|
|
+}
|
|
|
EXPORT_SYMBOL_GPL(nfs_file_set_open_context);
|
|
|
|
|
|
/*
|
|
@@ -748,10 +755,11 @@ struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_c
|
|
|
|
|
|
static void nfs_file_clear_open_context(struct file *filp)
|
|
|
{
|
|
|
- struct inode *inode = file_inode(filp);
|
|
|
struct nfs_open_context *ctx = nfs_file_open_context(filp);
|
|
|
|
|
|
if (ctx) {
|
|
|
+ struct inode *inode = ctx->dentry->d_inode;
|
|
|
+
|
|
|
filp->private_data = NULL;
|
|
|
spin_lock(&inode->i_lock);
|
|
|
list_move_tail(&ctx->list, &NFS_I(inode)->open_files);
|