diff options
author | Peng Tao <tao.peng@primarydata.com> | 2015-12-05 08:57:31 +0100 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2015-12-28 20:32:37 +0100 |
commit | 0bcbf039f6b2bcefe4f5dada76079080edf9ecd0 (patch) | |
tree | 8edf8f581dcd12258d7ab84898261a3a3d0ab2ef /fs/nfs/inode.c | |
parent | nfs: centralize pgio error cleanup (diff) | |
download | linux-0bcbf039f6b2bcefe4f5dada76079080edf9ecd0.tar.xz linux-0bcbf039f6b2bcefe4f5dada76079080edf9ecd0.zip |
nfs: handle request add failure properly
When we fail to queue a read page to IO descriptor,
we need to clean it up otherwise it is hanging around
preventing nfs module from being removed.
When we fail to queue a write page to IO descriptor,
we need to clean it up and also save the failure status
to open context. Then at file close, we can try to write
pages back again and drop the page if it fails to writeback
in .launder_page, which will be done in the next patch.
Signed-off-by: Peng Tao <tao.peng@primarydata.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Diffstat (limited to 'fs/nfs/inode.c')
-rw-r--r-- | fs/nfs/inode.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c index c7e8b87da5b2..74fb1223c2f5 100644 --- a/fs/nfs/inode.c +++ b/fs/nfs/inode.c @@ -912,6 +912,12 @@ void nfs_file_clear_open_context(struct file *filp) if (ctx) { struct inode *inode = d_inode(ctx->dentry); + /* + * We fatal error on write before. Try to writeback + * every page again. + */ + if (ctx->error < 0) + invalidate_inode_pages2(inode->i_mapping); filp->private_data = NULL; spin_lock(&inode->i_lock); list_move_tail(&ctx->list, &NFS_I(inode)->open_files); |