aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-06-22 18:20:23 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2011-07-20 01:43:41 -0400
commit643168c2dc0d04cb884ae7bcd1ee19d9ecdff6a8 (patch)
tree68c75e2a53096b2f6fe12b3f43b9fdb91d6dc484 /fs
parent7c97c200e2c5aa8b1067bebb99df0a7c2e12ebf3 (diff)
nfs4_closedata doesn't need to mess with struct path
instead of path_get()/path_put(), we can just use nfs_sb_{,de}active() to pin the superblock down. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/nfs4_fs.h10
-rw-r--r--fs/nfs/nfs4proc.c21
-rw-r--r--fs/nfs/nfs4state.c12
3 files changed, 21 insertions, 22 deletions
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index c4a69833dd0d..b788f2eb1ba0 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -238,7 +238,7 @@ extern int nfs4_proc_async_renew(struct nfs_client *, struct rpc_cred *);
238extern int nfs4_proc_renew(struct nfs_client *, struct rpc_cred *); 238extern int nfs4_proc_renew(struct nfs_client *, struct rpc_cred *);
239extern int nfs4_init_clientid(struct nfs_client *, struct rpc_cred *); 239extern int nfs4_init_clientid(struct nfs_client *, struct rpc_cred *);
240extern int nfs41_init_clientid(struct nfs_client *, struct rpc_cred *); 240extern int nfs41_init_clientid(struct nfs_client *, struct rpc_cred *);
241extern int nfs4_do_close(struct path *path, struct nfs4_state *state, gfp_t gfp_mask, int wait, bool roc); 241extern int nfs4_do_close(struct nfs4_state *state, gfp_t gfp_mask, int wait, bool roc);
242extern int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle); 242extern int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle);
243extern int nfs4_proc_fs_locations(struct inode *dir, const struct qstr *name, 243extern int nfs4_proc_fs_locations(struct inode *dir, const struct qstr *name,
244 struct nfs4_fs_locations *fs_locations, struct page *page); 244 struct nfs4_fs_locations *fs_locations, struct page *page);
@@ -341,8 +341,8 @@ extern struct nfs4_state_owner * nfs4_get_state_owner(struct nfs_server *, struc
341extern void nfs4_put_state_owner(struct nfs4_state_owner *); 341extern void nfs4_put_state_owner(struct nfs4_state_owner *);
342extern struct nfs4_state * nfs4_get_open_state(struct inode *, struct nfs4_state_owner *); 342extern struct nfs4_state * nfs4_get_open_state(struct inode *, struct nfs4_state_owner *);
343extern void nfs4_put_open_state(struct nfs4_state *); 343extern void nfs4_put_open_state(struct nfs4_state *);
344extern void nfs4_close_state(struct path *, struct nfs4_state *, fmode_t); 344extern void nfs4_close_state(struct nfs4_state *, fmode_t);
345extern void nfs4_close_sync(struct path *, struct nfs4_state *, fmode_t); 345extern void nfs4_close_sync(struct nfs4_state *, fmode_t);
346extern void nfs4_state_set_mode_locked(struct nfs4_state *, fmode_t); 346extern void nfs4_state_set_mode_locked(struct nfs4_state *, fmode_t);
347extern void nfs4_schedule_lease_recovery(struct nfs_client *); 347extern void nfs4_schedule_lease_recovery(struct nfs_client *);
348extern void nfs4_schedule_state_manager(struct nfs_client *); 348extern void nfs4_schedule_state_manager(struct nfs_client *);
@@ -373,8 +373,8 @@ extern struct svc_version nfs4_callback_version4;
373 373
374#else 374#else
375 375
376#define nfs4_close_state(a, b, c) do { } while (0) 376#define nfs4_close_state(a, b) do { } while (0)
377#define nfs4_close_sync(a, b, c) do { } while (0) 377#define nfs4_close_sync(a, b) do { } while (0)
378 378
379#endif /* CONFIG_NFS_V4 */ 379#endif /* CONFIG_NFS_V4 */
380#endif /* __LINUX_FS_NFS_NFS4_FS.H */ 380#endif /* __LINUX_FS_NFS_NFS4_FS.H */
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 5879b23e0c99..e99d674149ae 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -1154,7 +1154,7 @@ static int nfs4_open_recover_helper(struct nfs4_opendata *opendata, fmode_t fmod
1154 newstate = nfs4_opendata_to_nfs4_state(opendata); 1154 newstate = nfs4_opendata_to_nfs4_state(opendata);
1155 if (IS_ERR(newstate)) 1155 if (IS_ERR(newstate))
1156 return PTR_ERR(newstate); 1156 return PTR_ERR(newstate);
1157 nfs4_close_state(&opendata->path, newstate, fmode); 1157 nfs4_close_state(newstate, fmode);
1158 *res = newstate; 1158 *res = newstate;
1159 return 0; 1159 return 0;
1160} 1160}
@@ -1352,7 +1352,7 @@ static void nfs4_open_confirm_release(void *calldata)
1352 goto out_free; 1352 goto out_free;
1353 state = nfs4_opendata_to_nfs4_state(data); 1353 state = nfs4_opendata_to_nfs4_state(data);
1354 if (!IS_ERR(state)) 1354 if (!IS_ERR(state))
1355 nfs4_close_state(&data->path, state, data->o_arg.fmode); 1355 nfs4_close_state(state, data->o_arg.fmode);
1356out_free: 1356out_free:
1357 nfs4_opendata_put(data); 1357 nfs4_opendata_put(data);
1358} 1358}
@@ -1497,7 +1497,7 @@ static void nfs4_open_release(void *calldata)
1497 goto out_free; 1497 goto out_free;
1498 state = nfs4_opendata_to_nfs4_state(data); 1498 state = nfs4_opendata_to_nfs4_state(data);
1499 if (!IS_ERR(state)) 1499 if (!IS_ERR(state))
1500 nfs4_close_state(&data->path, state, data->o_arg.fmode); 1500 nfs4_close_state(state, data->o_arg.fmode);
1501out_free: 1501out_free:
1502 nfs4_opendata_put(data); 1502 nfs4_opendata_put(data);
1503} 1503}
@@ -1873,7 +1873,6 @@ static int nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred,
1873} 1873}
1874 1874
1875struct nfs4_closedata { 1875struct nfs4_closedata {
1876 struct path path;
1877 struct inode *inode; 1876 struct inode *inode;
1878 struct nfs4_state *state; 1877 struct nfs4_state *state;
1879 struct nfs_closeargs arg; 1878 struct nfs_closeargs arg;
@@ -1888,13 +1887,14 @@ static void nfs4_free_closedata(void *data)
1888{ 1887{
1889 struct nfs4_closedata *calldata = data; 1888 struct nfs4_closedata *calldata = data;
1890 struct nfs4_state_owner *sp = calldata->state->owner; 1889 struct nfs4_state_owner *sp = calldata->state->owner;
1890 struct super_block *sb = calldata->state->inode->i_sb;
1891 1891
1892 if (calldata->roc) 1892 if (calldata->roc)
1893 pnfs_roc_release(calldata->state->inode); 1893 pnfs_roc_release(calldata->state->inode);
1894 nfs4_put_open_state(calldata->state); 1894 nfs4_put_open_state(calldata->state);
1895 nfs_free_seqid(calldata->arg.seqid); 1895 nfs_free_seqid(calldata->arg.seqid);
1896 nfs4_put_state_owner(sp); 1896 nfs4_put_state_owner(sp);
1897 path_put(&calldata->path); 1897 nfs_sb_deactive(sb);
1898 kfree(calldata); 1898 kfree(calldata);
1899} 1899}
1900 1900
@@ -2014,7 +2014,7 @@ static const struct rpc_call_ops nfs4_close_ops = {
2014 * 2014 *
2015 * NOTE: Caller must be holding the sp->so_owner semaphore! 2015 * NOTE: Caller must be holding the sp->so_owner semaphore!
2016 */ 2016 */
2017int nfs4_do_close(struct path *path, struct nfs4_state *state, gfp_t gfp_mask, int wait, bool roc) 2017int nfs4_do_close(struct nfs4_state *state, gfp_t gfp_mask, int wait, bool roc)
2018{ 2018{
2019 struct nfs_server *server = NFS_SERVER(state->inode); 2019 struct nfs_server *server = NFS_SERVER(state->inode);
2020 struct nfs4_closedata *calldata; 2020 struct nfs4_closedata *calldata;
@@ -2050,8 +2050,7 @@ int nfs4_do_close(struct path *path, struct nfs4_state *state, gfp_t gfp_mask, i
2050 calldata->res.seqid = calldata->arg.seqid; 2050 calldata->res.seqid = calldata->arg.seqid;
2051 calldata->res.server = server; 2051 calldata->res.server = server;
2052 calldata->roc = roc; 2052 calldata->roc = roc;
2053 path_get(path); 2053 nfs_sb_active(calldata->inode->i_sb);
2054 calldata->path = *path;
2055 2054
2056 msg.rpc_argp = &calldata->arg; 2055 msg.rpc_argp = &calldata->arg;
2057 msg.rpc_resp = &calldata->res; 2056 msg.rpc_resp = &calldata->res;
@@ -2092,9 +2091,9 @@ static void nfs4_close_context(struct nfs_open_context *ctx, int is_sync)
2092 if (ctx->state == NULL) 2091 if (ctx->state == NULL)
2093 return; 2092 return;
2094 if (is_sync) 2093 if (is_sync)
2095 nfs4_close_sync(&ctx->path, ctx->state, ctx->mode); 2094 nfs4_close_sync(ctx->state, ctx->mode);
2096 else 2095 else
2097 nfs4_close_state(&ctx->path, ctx->state, ctx->mode); 2096 nfs4_close_state(ctx->state, ctx->mode);
2098} 2097}
2099 2098
2100static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle) 2099static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle)
@@ -2642,7 +2641,7 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
2642 if (ctx != NULL) 2641 if (ctx != NULL)
2643 ctx->state = state; 2642 ctx->state = state;
2644 else 2643 else
2645 nfs4_close_sync(path, state, fmode); 2644 nfs4_close_sync(state, fmode);
2646out: 2645out:
2647 return status; 2646 return status;
2648} 2647}
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index e97dd219f84f..7acfe8843626 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -641,7 +641,7 @@ void nfs4_put_open_state(struct nfs4_state *state)
641/* 641/*
642 * Close the current file. 642 * Close the current file.
643 */ 643 */
644static void __nfs4_close(struct path *path, struct nfs4_state *state, 644static void __nfs4_close(struct nfs4_state *state,
645 fmode_t fmode, gfp_t gfp_mask, int wait) 645 fmode_t fmode, gfp_t gfp_mask, int wait)
646{ 646{
647 struct nfs4_state_owner *owner = state->owner; 647 struct nfs4_state_owner *owner = state->owner;
@@ -685,18 +685,18 @@ static void __nfs4_close(struct path *path, struct nfs4_state *state,
685 } else { 685 } else {
686 bool roc = pnfs_roc(state->inode); 686 bool roc = pnfs_roc(state->inode);
687 687
688 nfs4_do_close(path, state, gfp_mask, wait, roc); 688 nfs4_do_close(state, gfp_mask, wait, roc);
689 } 689 }
690} 690}
691 691
692void nfs4_close_state(struct path *path, struct nfs4_state *state, fmode_t fmode) 692void nfs4_close_state(struct nfs4_state *state, fmode_t fmode)
693{ 693{
694 __nfs4_close(path, state, fmode, GFP_NOFS, 0); 694 __nfs4_close(state, fmode, GFP_NOFS, 0);
695} 695}
696 696
697void nfs4_close_sync(struct path *path, struct nfs4_state *state, fmode_t fmode) 697void nfs4_close_sync(struct nfs4_state *state, fmode_t fmode)
698{ 698{
699 __nfs4_close(path, state, fmode, GFP_KERNEL, 1); 699 __nfs4_close(state, fmode, GFP_KERNEL, 1);
700} 700}
701 701
702/* 702/*