Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

NFS: Fix a potential busy wait in nfs_page_group_lock

We cannot allow nfs_page_group_lock to use TASK_KILLABLE here, since
the loop would cause a busy wait if somebody kills the task.

Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>

+9 -10
+9 -10
fs/nfs/pagelist.c
··· 138 138 return __nfs_iocounter_wait(c); 139 139 } 140 140 141 + static int nfs_wait_bit_uninterruptible(void *word) 142 + { 143 + io_schedule(); 144 + return 0; 145 + } 146 + 141 147 /* 142 148 * nfs_page_group_lock - lock the head of the page group 143 149 * @req - request in group that is to be locked ··· 154 148 nfs_page_group_lock(struct nfs_page *req) 155 149 { 156 150 struct nfs_page *head = req->wb_head; 157 - int err = -EAGAIN; 158 151 159 152 WARN_ON_ONCE(head != head->wb_head); 160 153 161 - while (err) 162 - err = wait_on_bit_lock(&head->wb_flags, PG_HEADLOCK, 163 - nfs_wait_bit_killable, TASK_KILLABLE); 154 + wait_on_bit_lock(&head->wb_flags, PG_HEADLOCK, 155 + nfs_wait_bit_uninterruptible, 156 + TASK_UNINTERRUPTIBLE); 164 157 } 165 158 166 159 /* ··· 413 408 void nfs_release_request(struct nfs_page *req) 414 409 { 415 410 kref_put(&req->wb_kref, nfs_page_group_destroy); 416 - } 417 - 418 - static int nfs_wait_bit_uninterruptible(void *word) 419 - { 420 - io_schedule(); 421 - return 0; 422 411 } 423 412 424 413 /**