فهرست منبع

NFSv4.x/pnfs: Fix a race between layoutget and bulk recalls

Replace another case where the layout 'plh_block_lgets' can trigger
infinite loops in send_layoutget().

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
Trond Myklebust 9 سال پیش
والد
کامیت
9fd4b9fc76
1فایلهای تغییر یافته به همراه6 افزوده شده و 11 حذف شده
  1. 6 11
      fs/nfs/pnfs.c

+ 6 - 11
fs/nfs/pnfs.c

@@ -259,7 +259,7 @@ pnfs_put_layout_hdr(struct pnfs_layout_hdr *lo)
  * is required.
  * is required.
  * Note that caller must hold inode->i_lock.
  * Note that caller must hold inode->i_lock.
  */
  */
-static void
+static int
 pnfs_mark_layout_stateid_invalid(struct pnfs_layout_hdr *lo,
 pnfs_mark_layout_stateid_invalid(struct pnfs_layout_hdr *lo,
 		struct list_head *lseg_list)
 		struct list_head *lseg_list)
 {
 {
@@ -270,7 +270,7 @@ pnfs_mark_layout_stateid_invalid(struct pnfs_layout_hdr *lo,
 	};
 	};
 
 
 	set_bit(NFS_LAYOUT_INVALID_STID, &lo->plh_flags);
 	set_bit(NFS_LAYOUT_INVALID_STID, &lo->plh_flags);
-	pnfs_mark_matching_lsegs_invalid(lo, lseg_list, &range);
+	return pnfs_mark_matching_lsegs_invalid(lo, lseg_list, &range);
 }
 }
 
 
 static int
 static int
@@ -637,11 +637,6 @@ pnfs_layout_free_bulk_destroy_list(struct list_head *layout_list,
 {
 {
 	struct pnfs_layout_hdr *lo;
 	struct pnfs_layout_hdr *lo;
 	struct inode *inode;
 	struct inode *inode;
-	struct pnfs_layout_range range = {
-		.iomode = IOMODE_ANY,
-		.offset = 0,
-		.length = NFS4_MAX_UINT64,
-	};
 	LIST_HEAD(lseg_list);
 	LIST_HEAD(lseg_list);
 	int ret = 0;
 	int ret = 0;
 
 
@@ -656,11 +651,11 @@ pnfs_layout_free_bulk_destroy_list(struct list_head *layout_list,
 
 
 		spin_lock(&inode->i_lock);
 		spin_lock(&inode->i_lock);
 		list_del_init(&lo->plh_bulk_destroy);
 		list_del_init(&lo->plh_bulk_destroy);
-		lo->plh_block_lgets++; /* permanently block new LAYOUTGETs */
-		if (is_bulk_recall)
-			set_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags);
-		if (pnfs_mark_matching_lsegs_invalid(lo, &lseg_list, &range))
+		if (pnfs_mark_layout_stateid_invalid(lo, &lseg_list)) {
+			if (is_bulk_recall)
+				set_bit(NFS_LAYOUT_BULK_RECALL, &lo->plh_flags);
 			ret = -EAGAIN;
 			ret = -EAGAIN;
+		}
 		spin_unlock(&inode->i_lock);
 		spin_unlock(&inode->i_lock);
 		pnfs_free_lseg_list(&lseg_list);
 		pnfs_free_lseg_list(&lseg_list);
 		/* Free all lsegs that are attached to commit buckets */
 		/* Free all lsegs that are attached to commit buckets */