NFSv4.2/pnfs: Use GFP_NOIO for layoutstat reporting in the writeback path
authorTrond Myklebust <trond.myklebust@primarydata.com>
Wed, 5 Aug 2015 21:31:58 +0000 (17:31 -0400)
committerTrond Myklebust <trond.myklebust@primarydata.com>
Wed, 12 Aug 2015 18:27:23 +0000 (14:27 -0400)
Prevent a potential deadlock.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
fs/nfs/flexfilelayout/flexfilelayout.c
fs/nfs/pnfs.c
fs/nfs/pnfs.h

index ba74b15bf0ba02541c7c4b9f89f5223db645a615..2a93bec7e6dd0b7d1585f348dd138f3d31e6d1d9 100644 (file)
@@ -510,7 +510,8 @@ nfs4_ff_layout_stat_io_start_read(struct nfs4_ff_layout_mirror *mirror,
        spin_unlock(&mirror->lock);
 
        if (report)
-               pnfs_report_layoutstat(mirror->lseg->pls_layout->plh_inode);
+               pnfs_report_layoutstat(mirror->lseg->pls_layout->plh_inode,
+                               GFP_KERNEL);
 }
 
 static void
@@ -538,7 +539,8 @@ nfs4_ff_layout_stat_io_start_write(struct nfs4_ff_layout_mirror *mirror,
        spin_unlock(&mirror->lock);
 
        if (report)
-               pnfs_report_layoutstat(mirror->lseg->pls_layout->plh_inode);
+               pnfs_report_layoutstat(mirror->lseg->pls_layout->plh_inode,
+                               GFP_NOIO);
 }
 
 static void
index 70bf706b10904e156affe9dd4bea2ec9a17776c5..a6ec420983d1b4b9e67bb3897416dc18a92c5bad 100644 (file)
@@ -2267,7 +2267,7 @@ struct nfs4_threshold *pnfs_mdsthreshold_alloc(void)
 
 #if IS_ENABLED(CONFIG_NFS_V4_2)
 int
-pnfs_report_layoutstat(struct inode *inode)
+pnfs_report_layoutstat(struct inode *inode, gfp_t gfp_flags)
 {
        struct pnfs_layoutdriver_type *ld = NFS_SERVER(inode)->pnfs_curr_ld;
        struct nfs_server *server = NFS_SERVER(inode);
@@ -2294,7 +2294,7 @@ pnfs_report_layoutstat(struct inode *inode)
        pnfs_get_layout_hdr(hdr);
        spin_unlock(&inode->i_lock);
 
-       data = kzalloc(sizeof(*data), GFP_KERNEL);
+       data = kzalloc(sizeof(*data), gfp_flags);
        if (!data) {
                status = -ENOMEM;
                goto out_put;
index 3e6ab7bfbabd428425227b6f9d2a94711edd371e..738672a0f8da975503a7318512397d35e213fb3c 100644 (file)
@@ -691,10 +691,10 @@ static inline void nfs4_pnfs_v3_ds_connect_unload(void)
 #endif /* CONFIG_NFS_V4_1 */
 
 #if IS_ENABLED(CONFIG_NFS_V4_2)
-int pnfs_report_layoutstat(struct inode *inode);
+int pnfs_report_layoutstat(struct inode *inode, gfp_t gfp_flags);
 #else
 static inline int
-pnfs_report_layoutstat(struct inode *inode)
+pnfs_report_layoutstat(struct inode *inode, gfp_t gfp_flags)
 {
        return 0;
 }