Skip to content

Commit c8ad889

Browse files
committed
NFSv4.2/pnfs: Use GFP_NOIO for layoutstat reporting in the writeback path
Prevent a potential deadlock. Signed-off-by: Trond Myklebust <[email protected]>
1 parent d099d7b commit c8ad889

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

fs/nfs/flexfilelayout/flexfilelayout.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,8 @@ nfs4_ff_layout_stat_io_start_read(struct nfs4_ff_layout_mirror *mirror,
510510
spin_unlock(&mirror->lock);
511511

512512
if (report)
513-
pnfs_report_layoutstat(mirror->lseg->pls_layout->plh_inode);
513+
pnfs_report_layoutstat(mirror->lseg->pls_layout->plh_inode,
514+
GFP_KERNEL);
514515
}
515516

516517
static void
@@ -538,7 +539,8 @@ nfs4_ff_layout_stat_io_start_write(struct nfs4_ff_layout_mirror *mirror,
538539
spin_unlock(&mirror->lock);
539540

540541
if (report)
541-
pnfs_report_layoutstat(mirror->lseg->pls_layout->plh_inode);
542+
pnfs_report_layoutstat(mirror->lseg->pls_layout->plh_inode,
543+
GFP_NOIO);
542544
}
543545

544546
static void

fs/nfs/pnfs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2267,7 +2267,7 @@ struct nfs4_threshold *pnfs_mdsthreshold_alloc(void)
22672267

22682268
#if IS_ENABLED(CONFIG_NFS_V4_2)
22692269
int
2270-
pnfs_report_layoutstat(struct inode *inode)
2270+
pnfs_report_layoutstat(struct inode *inode, gfp_t gfp_flags)
22712271
{
22722272
struct pnfs_layoutdriver_type *ld = NFS_SERVER(inode)->pnfs_curr_ld;
22732273
struct nfs_server *server = NFS_SERVER(inode);
@@ -2294,7 +2294,7 @@ pnfs_report_layoutstat(struct inode *inode)
22942294
pnfs_get_layout_hdr(hdr);
22952295
spin_unlock(&inode->i_lock);
22962296

2297-
data = kzalloc(sizeof(*data), GFP_KERNEL);
2297+
data = kzalloc(sizeof(*data), gfp_flags);
22982298
if (!data) {
22992299
status = -ENOMEM;
23002300
goto out_put;

fs/nfs/pnfs.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,10 +691,10 @@ static inline void nfs4_pnfs_v3_ds_connect_unload(void)
691691
#endif /* CONFIG_NFS_V4_1 */
692692

693693
#if IS_ENABLED(CONFIG_NFS_V4_2)
694-
int pnfs_report_layoutstat(struct inode *inode);
694+
int pnfs_report_layoutstat(struct inode *inode, gfp_t gfp_flags);
695695
#else
696696
static inline int
697-
pnfs_report_layoutstat(struct inode *inode)
697+
pnfs_report_layoutstat(struct inode *inode, gfp_t gfp_flags)
698698
{
699699
return 0;
700700
}

0 commit comments

Comments
 (0)