diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-10-28 14:57:12 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-11-29 14:11:49 -0500 |
commit | 1311157d8407d16b8543c2286f0e95251ca04fe8 (patch) | |
tree | 20e3a394619fb0f1a5fee5073dbe5b8b840a6ff3 /fs | |
parent | 231817ee68a9640d91ef34ce12c4d67b38f17ed8 (diff) |
NFSv4: Fix state reference counting in _nfs4_opendata_reclaim_to_nfs4_state
commit d49f042aeec99c5f87160bb52dd52088b1051311 upstream.
Currently, if the call to nfs_refresh_inode fails, then we end up leaking
a reference count, due to the call to nfs4_get_open_state.
While we're at it, replace nfs4_get_open_state with a simple call to
atomic_inc(); there is no need to do a full lookup of the struct nfs_state
since it is passed as an argument in the struct nfs4_opendata, and
is already assigned to the variable 'state'.
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/nfs4proc.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index d097233cd33b..e78b8c2656ee 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -1168,11 +1168,6 @@ _nfs4_opendata_reclaim_to_nfs4_state(struct nfs4_opendata *data) | |||
1168 | goto update; | 1168 | goto update; |
1169 | } | 1169 | } |
1170 | 1170 | ||
1171 | ret = -ENOMEM; | ||
1172 | state = nfs4_get_open_state(inode, data->owner); | ||
1173 | if (state == NULL) | ||
1174 | goto err; | ||
1175 | |||
1176 | ret = nfs_refresh_inode(inode, &data->f_attr); | 1171 | ret = nfs_refresh_inode(inode, &data->f_attr); |
1177 | if (ret) | 1172 | if (ret) |
1178 | goto err; | 1173 | goto err; |
@@ -1182,6 +1177,7 @@ _nfs4_opendata_reclaim_to_nfs4_state(struct nfs4_opendata *data) | |||
1182 | update: | 1177 | update: |
1183 | update_open_stateid(state, &data->o_res.stateid, NULL, | 1178 | update_open_stateid(state, &data->o_res.stateid, NULL, |
1184 | data->o_arg.fmode); | 1179 | data->o_arg.fmode); |
1180 | atomic_inc(&state->count); | ||
1185 | 1181 | ||
1186 | return state; | 1182 | return state; |
1187 | err: | 1183 | err: |