Details
-
Technical task
-
Resolution: Unresolved
-
Minor
-
None
-
None
-
None
-
9223372036854775807
Description
When benchmark with filebench oltp.f workload, the writer hanged.
After investigated, we found the following dead lock in WBC code:
static ssize_t memfs_file_write_iter(struct kiocb *iocb, struct iov_iter *iter) { down_read(&wbci->wbci_rw_sem); repeat: if (wbc_inode_data_caching(wbci)) { rc = generic_file_write_iter(iocb, iter); if (rc == -ENOSPC) GOTO(repeat, rc); } else { rc = ll_i2sbi(inode)->ll_fop->write_iter(iocb, iter); } up_read(&wbci->wbci_rw_sem); .... }
generic_file_write_iter() ->generic_write_sync(): static inline ssize_t generic_write_sync(struct kiocb *iocb, ssize_t count) { if (iocb->ki_flags & IOCB_DSYNC) { int ret = vfs_fsync_range(iocb->ki_filp, iocb->ki_pos - count, iocb->ki_pos - 1, (iocb->ki_flags & IOCB_SYNC) ? 0 : 1); ...
static int memfs_fsync(struct file *file, loff_t start, loff_t end, int datasync) { if (S_ISREG(inode->i_mode)) { down_write(&wbci->wbci_rw_sem); //** rc = wbcfs_commit_cache_pages(inode); up_write(&wbci->wbci_rw_sem); //** } ... }