All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH -next] NFSv4: Use GFP_ATOMIC under spin lock in _pnfs_grab_empty_layout()
@ 2020-04-28  7:19 ` Wei Yongjun
  0 siblings, 0 replies; 8+ messages in thread
From: Wei Yongjun @ 2020-04-28  7:19 UTC (permalink / raw)
  To: Trond Myklebust, Anna Schumaker; +Cc: Wei Yongjun, linux-nfs, kernel-janitors

A spin lock is taken here so we should use GFP_ATOMIC.

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 dd2e14f5875d..d84c1b7b71d2 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -2170,7 +2170,7 @@ _pnfs_grab_empty_layout(struct inode *ino, struct nfs_open_context *ctx)
 	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))

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH -next] NFSv4: Use GFP_ATOMIC under spin lock in _pnfs_grab_empty_layout()
@ 2020-04-28  7:19 ` Wei Yongjun
  0 siblings, 0 replies; 8+ messages in thread
From: Wei Yongjun @ 2020-04-28  7:19 UTC (permalink / raw)
  To: Trond Myklebust, Anna Schumaker; +Cc: Wei Yongjun, linux-nfs, kernel-janitors

A spin lock is taken here so we should use GFP_ATOMIC.

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 dd2e14f5875d..d84c1b7b71d2 100644
--- a/fs/nfs/pnfs.c
+++ b/fs/nfs/pnfs.c
@@ -2170,7 +2170,7 @@ _pnfs_grab_empty_layout(struct inode *ino, struct nfs_open_context *ctx)
 	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))




^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH -next] NFSv4: Use GFP_ATOMIC under spin lock in _pnfs_grab_empty_layout()
  2020-04-28  7:19 ` Wei Yongjun
@ 2020-04-28 17:41   ` Trond Myklebust
  -1 siblings, 0 replies; 8+ messages in thread
From: Trond Myklebust @ 2020-04-28 17:41 UTC (permalink / raw)
  To: weiyongjun1, anna.schumaker; +Cc: linux-nfs, kernel-janitors

T24gVHVlLCAyMDIwLTA0LTI4IGF0IDA3OjE5ICswMDAwLCBXZWkgWW9uZ2p1biB3cm90ZToNCj4g
QSBzcGluIGxvY2sgaXMgdGFrZW4gaGVyZSBzbyB3ZSBzaG91bGQgdXNlIEdGUF9BVE9NSUMuDQo+
IA0KPiBTaWduZWQtb2ZmLWJ5OiBXZWkgWW9uZ2p1biA8d2VpeW9uZ2p1bjFAaHVhd2VpLmNvbT4N
Cj4gLS0tDQo+ICBmcy9uZnMvcG5mcy5jIHwgMiArLQ0KPiAgMSBmaWxlIGNoYW5nZWQsIDEgaW5z
ZXJ0aW9uKCspLCAxIGRlbGV0aW9uKC0pDQo+IA0KPiBkaWZmIC0tZ2l0IGEvZnMvbmZzL3BuZnMu
YyBiL2ZzL25mcy9wbmZzLmMNCj4gaW5kZXggZGQyZTE0ZjU4NzVkLi5kODRjMWI3YjcxZDIgMTAw
NjQ0DQo+IC0tLSBhL2ZzL25mcy9wbmZzLmMNCj4gKysrIGIvZnMvbmZzL3BuZnMuYw0KPiBAQCAt
MjE3MCw3ICsyMTcwLDcgQEAgX3BuZnNfZ3JhYl9lbXB0eV9sYXlvdXQoc3RydWN0IGlub2RlICpp
bm8sDQo+IHN0cnVjdCBuZnNfb3Blbl9jb250ZXh0ICpjdHgpDQo+ICAJc3RydWN0IHBuZnNfbGF5
b3V0X2hkciAqbG87DQo+ICANCj4gIAlzcGluX2xvY2soJmluby0+aV9sb2NrKTsNCj4gLQlsbyA9
IHBuZnNfZmluZF9hbGxvY19sYXlvdXQoaW5vLCBjdHgsIEdGUF9LRVJORUwpOw0KPiArCWxvID0g
cG5mc19maW5kX2FsbG9jX2xheW91dChpbm8sIGN0eCwgR0ZQX0FUT01JQyk7DQo+ICAJaWYgKCFs
bykNCj4gIAkJZ290byBvdXRfdW5sb2NrOw0KPiAgCWlmICghdGVzdF9iaXQoTkZTX0xBWU9VVF9J
TlZBTElEX1NUSUQsICZsby0+cGxoX2ZsYWdzKSkNCj4gDQo+IA0KPiANCg0KTkFDSy4gVGhlcmUg
aXMgbm8gYWxsb2NhdGlvbiB1bmRlciB0aGUgc3BpbmxvY2suDQoNCi0tIA0KVHJvbmQgTXlrbGVi
dXN0DQpMaW51eCBORlMgY2xpZW50IG1haW50YWluZXIsIEhhbW1lcnNwYWNlDQp0cm9uZC5teWts
ZWJ1c3RAaGFtbWVyc3BhY2UuY29tDQoNCg0K

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH -next] NFSv4: Use GFP_ATOMIC under spin lock in _pnfs_grab_empty_layout()
@ 2020-04-28 17:41   ` Trond Myklebust
  0 siblings, 0 replies; 8+ messages in thread
From: Trond Myklebust @ 2020-04-28 17:41 UTC (permalink / raw)
  To: weiyongjun1, anna.schumaker; +Cc: linux-nfs, kernel-janitors

On Tue, 2020-04-28 at 07:19 +0000, Wei Yongjun wrote:
> A spin lock is taken here so we should use GFP_ATOMIC.
> 
> 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 dd2e14f5875d..d84c1b7b71d2 100644
> --- a/fs/nfs/pnfs.c
> +++ b/fs/nfs/pnfs.c
> @@ -2170,7 +2170,7 @@ _pnfs_grab_empty_layout(struct inode *ino,
> struct nfs_open_context *ctx)
>  	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))
> 
> 
> 

NACK. There is no allocation under the spinlock.

-- 
Trond Myklebust
Linux NFS client maintainer, Hammerspace
trond.myklebust@hammerspace.com



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH -next] NFSv4: Use GFP_ATOMIC under spin lock in _pnfs_grab_empty_layout()
  2020-04-28  7:19 ` Wei Yongjun
@ 2020-04-28 18:04   ` Dan Carpenter
  -1 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2020-04-28 18:04 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: Trond Myklebust, Anna Schumaker, linux-nfs, kernel-janitors

On Tue, Apr 28, 2020 at 07:19:32AM +0000, Wei Yongjun wrote:
> A spin lock is taken here so we should use GFP_ATOMIC.
> 
> 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 dd2e14f5875d..d84c1b7b71d2 100644
> --- a/fs/nfs/pnfs.c
> +++ b/fs/nfs/pnfs.c
> @@ -2170,7 +2170,7 @@ _pnfs_grab_empty_layout(struct inode *ino, struct nfs_open_context *ctx)
>  	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);
                                    ^^^
It releases the lock before allocating.  It's annotated.

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH -next] NFSv4: Use GFP_ATOMIC under spin lock in _pnfs_grab_empty_layout()
@ 2020-04-28 18:04   ` Dan Carpenter
  0 siblings, 0 replies; 8+ messages in thread
From: Dan Carpenter @ 2020-04-28 18:04 UTC (permalink / raw)
  To: Wei Yongjun; +Cc: Trond Myklebust, Anna Schumaker, linux-nfs, kernel-janitors

On Tue, Apr 28, 2020 at 07:19:32AM +0000, Wei Yongjun wrote:
> A spin lock is taken here so we should use GFP_ATOMIC.
> 
> 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 dd2e14f5875d..d84c1b7b71d2 100644
> --- a/fs/nfs/pnfs.c
> +++ b/fs/nfs/pnfs.c
> @@ -2170,7 +2170,7 @@ _pnfs_grab_empty_layout(struct inode *ino, struct nfs_open_context *ctx)
>  	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);
                                    ^^^
It releases the lock before allocating.  It's annotated.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH -next] NFSv4: Use GFP_ATOMIC under spin lock in _pnfs_grab_empty_layout()
  2020-04-28 18:04   ` Dan Carpenter
@ 2020-04-29  1:03     ` Wei Yongjun
  -1 siblings, 0 replies; 8+ messages in thread
From: Wei Yongjun @ 2020-04-29  1:03 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Trond Myklebust, Anna Schumaker, linux-nfs, kernel-janitors



On 2020/4/29 2:04, Dan Carpenter wrote:
> On Tue, Apr 28, 2020 at 07:19:32AM +0000, Wei Yongjun wrote:
>> A spin lock is taken here so we should use GFP_ATOMIC.
>>
>> 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 dd2e14f5875d..d84c1b7b71d2 100644
>> --- a/fs/nfs/pnfs.c
>> +++ b/fs/nfs/pnfs.c
>> @@ -2170,7 +2170,7 @@ _pnfs_grab_empty_layout(struct inode *ino, struct nfs_open_context *ctx)
>>  	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);
>                                     ^^^
> It releases the lock before allocating.  It's annotated.
> 

Got it, thanks.

regards,
Wei Yongjun

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH -next] NFSv4: Use GFP_ATOMIC under spin lock in _pnfs_grab_empty_layout()
@ 2020-04-29  1:03     ` Wei Yongjun
  0 siblings, 0 replies; 8+ messages in thread
From: Wei Yongjun @ 2020-04-29  1:03 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: Trond Myklebust, Anna Schumaker, linux-nfs, kernel-janitors



On 2020/4/29 2:04, Dan Carpenter wrote:
> On Tue, Apr 28, 2020 at 07:19:32AM +0000, Wei Yongjun wrote:
>> A spin lock is taken here so we should use GFP_ATOMIC.
>>
>> 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 dd2e14f5875d..d84c1b7b71d2 100644
>> --- a/fs/nfs/pnfs.c
>> +++ b/fs/nfs/pnfs.c
>> @@ -2170,7 +2170,7 @@ _pnfs_grab_empty_layout(struct inode *ino, struct nfs_open_context *ctx)
>>  	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);
>                                     ^^^
> It releases the lock before allocating.  It's annotated.
> 

Got it, thanks.

regards,
Wei Yongjun

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-04-29  1:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-28  7:19 [PATCH -next] NFSv4: Use GFP_ATOMIC under spin lock in _pnfs_grab_empty_layout() Wei Yongjun
2020-04-28  7:19 ` Wei Yongjun
2020-04-28 17:41 ` Trond Myklebust
2020-04-28 17:41   ` Trond Myklebust
2020-04-28 18:04 ` Dan Carpenter
2020-04-28 18:04   ` Dan Carpenter
2020-04-29  1:03   ` Wei Yongjun
2020-04-29  1:03     ` Wei Yongjun

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.