[-next] pnfs: Use GFP_ATOMIC under spin lock
diff mbox

Message ID 1528250538-50721-1-git-send-email-weiyongjun1@huawei.com
State New
Headers show

Commit Message

Wei Yongjun June 6, 2018, 2:02 a.m. UTC
A spin lock is taken here so we should use GFP_ATOMIC.

Fixes: 2409a976a299 ("pnfs: Add LAYOUTGET to OPEN of a new file")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 fs/nfs/pnfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Trond Myklebust June 6, 2018, 2:21 a.m. UTC | #1
On Wed, 2018-06-06 at 02:02 +0000, Wei Yongjun wrote:
> A spin lock is taken here so we should use GFP_ATOMIC.

> 

> Fixes: 2409a976a299 ("pnfs: Add LAYOUTGET to OPEN of a new file")

> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

> ---

>  fs/nfs/pnfs.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c

> index d93942f..1ff1998 100644

> --- a/fs/nfs/pnfs.c

> +++ b/fs/nfs/pnfs.c

> @@ -2009,7 +2009,7 @@ struct pnfs_layout_segment *

>  	struct pnfs_layout_hdr *lo;

>  

>  	spin_lock(&ino->i_lock);

> -	lo = pnfs_find_alloc_layout(ino, ctx, GFP_KERNEL);

> +	lo = pnfs_find_alloc_layout(ino, ctx, GFP_ATOMIC);

>  	if (!lo)

>  		goto out_unlock;

>  	if (!test_bit(NFS_LAYOUT_INVALID_STID, &lo->plh_flags))

> 

Hi Wei,

The ino->i_lock spinlock is temporarily dropped inside
pnfs_find_alloc_layout() if we have to perform an allocation, so the
existing code should be correct.

Cheers
  Trond

-- 
Trond Myklebust
CTO, Hammerspace Inc
4300 El Camino Real, Suite 105
Los Altos, CA 94022
www.hammer.space id="-x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0gcG5mc19maW5kX2FsbG9jX2xheW91dChpbm8sIGN0eCwgR0ZQX0FUT01JQyk7DQo+ID4gIAlp
ZiAoIWxvKQ0KPiA+ICAJCWdvdG8gb3V0X3VubG9jazsNCj4gPiAgCWlmICghdGVzdF9iaXQoTkZT
X0xBWU9VVF9JTlZBTElEX1NUSUQsICZsby0+cGxoX2ZsYWdzKSkNCj4gPg0KPiBIaSBXZWksDQo+
IA0KPiBUaGUgaW5vLT5pX2xvY2sgc3BpbmxvY2sgaXMgdGVtcG9yYXJpbHkgZHJvcHBlZCBpbnNp
ZGUNCj4gcG5mc19maW5kX2FsbG9jX2xheW91dCgpIGlmIHdlIGhhdmUgdG8gcGVyZm9ybSBhbiBh
bGxvY2F0aW9uLCBzbyB0aGUNCj4gZXhpc3RpbmcgY29kZSBzaG91bGQgYmUgY29ycmVjdC4NCg0K
SGkgVHJvbmQsDQoNClllcywgeW91IGFyZSByaWdodCwgdGhhbmtzIGZvciByZXZpZXcuDQoNClJl
Z2FyZHMNCg0K
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/fs/nfs/pnfs.c b/fs/nfs/pnfs.c
index d93942f..1ff1998 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -2009,7 +2009,7 @@  struct pnfs_layout_segment *
 	struct pnfs_layout_hdr *lo;
 
 	spin_lock(&ino->i_lock);
-	lo = pnfs_find_alloc_layout(ino, ctx, GFP_KERNEL);
+	lo = pnfs_find_alloc_layout(ino, ctx, GFP_ATOMIC);
 	if (!lo)
 		goto out_unlock;
 	if (!test_bit(NFS_LAYOUT_INVALID_STID, &lo->plh_flags))