Skip to content

Commit

Permalink
NFS: Do cleanup before resetting pageio read/write to mds
Browse files Browse the repository at this point in the history
There is a reference leak of layout segment after resetting
pageio read/write to mds.

Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Cc: stable@vger.kernel.org # v4.0+
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
  • Loading branch information
Kinglong Mee authored and Trond Myklebust committed Sep 20, 2015
1 parent 4b0ab51 commit 6f29b9b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/nfs/read.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ void nfs_pageio_reset_read_mds(struct nfs_pageio_descriptor *pgio)
{
struct nfs_pgio_mirror *mirror;

if (pgio->pg_ops && pgio->pg_ops->pg_cleanup)
pgio->pg_ops->pg_cleanup(pgio);

pgio->pg_ops = &nfs_pgio_rw_ops;

/* read path should never have more than one mirror */
Expand Down
3 changes: 3 additions & 0 deletions fs/nfs/write.c
Original file line number Diff line number Diff line change
Expand Up @@ -1351,6 +1351,9 @@ void nfs_pageio_reset_write_mds(struct nfs_pageio_descriptor *pgio)
{
struct nfs_pgio_mirror *mirror;

if (pgio->pg_ops && pgio->pg_ops->pg_cleanup)
pgio->pg_ops->pg_cleanup(pgio);

pgio->pg_ops = &nfs_pgio_rw_ops;

nfs_pageio_stop_mirroring(pgio);
Expand Down

0 comments on commit 6f29b9b

Please sign in to comment.