NFSv4: open context can be NULL in nfs_put_open_context
Subsystems (2)
PATCH 1/1 NFSv4: open context can be NULL in nfs_put_open_context
From: Andy Adamson <[email protected]>
If a pgio error is caught before the nfs_pgio_header args->context is set with get_nfs_open_context, the context can be NULL.
--- fs/nfs/inode.c | 3 +++ 1 file changed, 3 insertions(+)
fs/nfs/inode.c +3 -0
@@ -798,6 +798,9 @@ static void __put_nfs_open_context(struct nfs_open_context *ctx, int is_sync)struct inode *inode = ctx->dentry->d_inode;struct super_block *sb = ctx->dentry->d_sb; +if (ctx ==NULL ) +return ; +if (!list_empty (&ctx->list)) {if (!atomic_dec_and_lock (&ctx->lock_context.count, &inode->i_lock))return ;
Signature · 1 line
1.8.3.1
Quoted 4 lines · On Oct 13, 2014, at 10:08 AM, [email protected] wrote:
From: Andy Adamson <[email protected]>
If a pgio error is caught before the
nfs_pgio_headerargs->contextis set withget_nfs_open_context, the context can be NULL.
It looks like all three calls to nfs_pgio_error would hit this!
The fix looks good to me.
-dros
Quoted 27 lines
Signed-off-by Andy Adamson <[email protected]>---
fs/nfs/inode.c| 3 +++1 file changed, 3 insertions(+)fs/nfs/inode.c +3
-0@@ -798,6 +798,9 @@ static void __put_nfs_open_context(struct nfs_open_context *ctx, int is_sync)struct inode *inode = ctx->dentry->d_inode;struct super_block *sb = ctx->dentry->d_sb; +if (ctx ==NULL ) +return ; +if (!list_empty (&ctx->list)) {if (!atomic_dec_and_lock (&ctx->lock_context.count, &inode->i_lock))return ;Signature · 6 lines
1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): CAHQdGtT12WC896sZwHQkgXgiPx0ODckX2dhNZb0O+XHBUN2E-A@mail.gmail.com
Resending to list... Apologies for the duplicate...
Quoted 49 lines · Trond Myklebust
Hi Andy,
Quoted 26 lines · On Mon, Oct 13, 2014 at 10:08 AM, <[email protected]> wrote:
From: Andy Adamson <[email protected]>
If a pgio error is caught before the
nfs_pgio_headerargs->contextis set withget_nfs_open_context, the context can be NULL.Signed-off-by Andy Adamson <[email protected]>--- fs/nfs/inode.c | 3 +++ 1 file changed, 3 insertions(+)fs/nfs/inode.c +3
-0@@ -798,6 +798,9 @@ static void __put_nfs_open_context(struct nfs_open_context *ctx, int is_sync)struct inode *inode = ctx->dentry->d_inode;struct super_block *sb = ctx->dentry->d_sb; +if (ctx ==NULL ) +return ; + if (!list_empty(&ctx->list)) { if (!atomic_dec_and_lock(&ctx->lock_context.count,
&inode->i_lock))Quoted 4 lines
return;--
1.8.3.1AFAICS, there is only one callsite where we need to check the context, so we can avoid the check on all calls to
put_nfs_open_context. Please see PATCH 1/2 that I just posted in response to an off-list bug report from Steve Dickson.Cheers
Trond
--Trond Myklebust
Linux NFS client maintainer, PrimaryData
Signature · 5 lines
Trond Myklebust Linux NFS client maintainer, PrimaryData [email protected]
Quoted 43 lines · Trond Myklebust
Resending to list... Apologies for the duplicate...
Quoted 39 lines · Trond Myklebust
Hi Andy,
Quoted 26 lines · On Mon, Oct 13, 2014 at 10:08 AM, <[email protected]> wrote:
From: Andy Adamson <[email protected]>
If a pgio error is caught before the
nfs_pgio_headerargs->contextis set withget_nfs_open_context, the context can be NULL.Signed-off-by Andy Adamson <[email protected]>---
fs/nfs/inode.c| 3 +++1 file changed, 3 insertions(+)fs/nfs/inode.c +3
-0@@ -798,6 +798,9 @@ static void __put_nfs_open_context(struct nfs_open_context *ctx, int is_sync)struct inode *inode = ctx->dentry->d_inode;struct super_block *sb = ctx->dentry->d_sb; +if (ctx ==NULL ) +return ; + if (!list_empty(&ctx->list)) { if (!atomic_dec_and_lock(&ctx->lock_context.count,
&inode->i_lock))Quoted 4 lines
return;--
1.8.3.1AFAICS, there is only one callsite where we need to check the context, so we can avoid the check on all calls to
put_nfs_open_context. Please see PATCH 1/2 that I just posted in response to an off-list bug report from Steve Dickson.
Thanks Trond,
Both patches should fix the OOPS, but I think your reasoning to avoid the check in all calls to put_nfs_open_context makes sense.
-dros
Quoted 23 lines
Quoted 10 lines
Cheers
Trond
--Trond Myklebust
Linux NFS client maintainer, PrimaryData
Signature · 9 lines
Trond Myklebust Linux NFS client maintainer, PrimaryData [email protected] -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html