* [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
2020-04-28 18:04 ` Dan Carpenter
0 siblings, 2 replies; 4+ 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] 4+ messages in thread
* Re: [PATCH -next] NFSv4: Use GFP_ATOMIC under spin lock in _pnfs_grab_empty_layout()
2020-04-28 7:19 [PATCH -next] NFSv4: Use GFP_ATOMIC under spin lock in _pnfs_grab_empty_layout() Wei Yongjun
@ 2020-04-28 17:41 ` Trond Myklebust
2020-04-28 18:04 ` Dan Carpenter
1 sibling, 0 replies; 4+ messages in thread
From: Trond Myklebust @ 2020-04-28 17:41 UTC (permalink / raw)
To: weiyongjun1@huawei.com, anna.schumaker@netapp.com
Cc: linux-nfs@vger.kernel.org, kernel-janitors@vger.kernel.org
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] 4+ messages in thread
* Re: [PATCH -next] NFSv4: Use GFP_ATOMIC under spin lock in _pnfs_grab_empty_layout()
2020-04-28 7:19 [PATCH -next] NFSv4: Use GFP_ATOMIC under spin lock in _pnfs_grab_empty_layout() Wei Yongjun
2020-04-28 17:41 ` Trond Myklebust
@ 2020-04-28 18:04 ` Dan Carpenter
2020-04-29 1:03 ` Wei Yongjun
1 sibling, 1 reply; 4+ 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] 4+ 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
0 siblings, 0 replies; 4+ 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] 4+ messages in thread
end of thread, other threads:[~2020-04-29 1:04 UTC | newest]
Thread overview: 4+ 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 17:41 ` Trond Myklebust
2020-04-28 18:04 ` Dan Carpenter
2020-04-29 1:03 ` Wei Yongjun
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox