truncate_inode_pages_final(mapping);
+ CFS_FAIL_TIMEOUT(OBD_FAIL_LLITE_DELAY_TRUNCATE, 5);
+
/* Workaround for LU-118: Note nrpages may not be totally updated when
* truncate_inode_pages() returns, as there can be a page in the process
* of deletion (inside __delete_from_page_cache()) in the specified
ll_xa_unlock_irqrestore(&mapping->i_pages, flags);
} /* Workaround end */
- LASSERTF(nrpages == 0, "%s: inode="DFID"(%p) nrpages=%lu "
- "state %#lx, lli_flags %#lx, "
- "see https://jira.whamcloud.com/browse/LU-118\n",
- ll_i2sbi(inode)->ll_fsname,
- PFID(ll_inode2fid(inode)), inode, nrpages,
- inode->i_state, ll_i2info(inode)->lli_flags);
+ if (nrpages) {
+#ifdef HAVE_XARRAY_SUPPORT
+ XA_STATE(xas, &mapping->i_pages, 0);
+ struct page *page;
+#endif
+ CWARN("%s: inode="DFID"(%p) nrpages=%lu "
+ "state %#lx, lli_flags %#lx, "
+ "see https://jira.whamcloud.com/browse/LU-118\n",
+ ll_i2sbi(inode)->ll_fsname,
+ PFID(ll_inode2fid(inode)), inode, nrpages,
+ inode->i_state, ll_i2info(inode)->lli_flags);
+#ifdef HAVE_XARRAY_SUPPORT
+ rcu_read_lock();
+ xas_for_each(&xas, page, ULONG_MAX) {
+ if (xas_retry(&xas, page))
+ continue;
+
+ if (xa_is_value(page))
+ continue;
+
+ /*
+ * We can only have non-uptodate pages
+ * without internal state at this point
+ */
+ LASSERTF(!PageUptodate(page) &&
+ !PageDirty(page) &&
+ !PagePrivate(page),
+ "%p", page);
+ }
+ rcu_read_unlock();
+#endif
+ }
}
int ll_read_inode2(struct inode *inode, void *opaque)
}
run_test 440 "bash completion for lfs, lctl"
+test_442() {
+ local pid1
+ local pid2
+ mkdir -p $DIR/$tdir
+ multiop $DIR/$tdir/$tfile.1 O_w1 & pid1=$!
+ multiop $DIR/$tdir/$tfile.1 O_w1 & pid2=$!
+ sleep 1
+ touch $DIR/$tdir/$tfile.2
+ $LFS swap_layouts -n $DIR/$tdir/$tfile.1 $DIR/$tdir/$tfile.2
+ $LCTL set_param fail_loc=0x1430
+ kill -USR1 $pid1
+ sleep 1
+ kill -USR1 $pid2
+ wait
+}
+run_test 442 "truncate vs read/write should not panic"
+
prep_801() {
[[ $MDS1_VERSION -lt $(version_code 2.9.55) ]] ||
[[ $OST1_VERSION -lt $(version_code 2.9.55) ]] &&
static int lfs_swap_layouts(int argc, char **argv)
{
- if (argc != 3)
+ int noxtime = 0;
+
+ if (argc == 4 && !strcmp(argv[1], "-n"))
+ noxtime = 1;
+ else if (argc != 3)
return CMD_HELP;
- return llapi_swap_layouts(argv[1], argv[2], 0, 0,
- SWAP_LAYOUTS_KEEP_MTIME |
- SWAP_LAYOUTS_KEEP_ATIME);
+ return llapi_swap_layouts(argv[1+noxtime], argv[2+noxtime],
+ 0, 0, noxtime ? 0 :
+ (SWAP_LAYOUTS_KEEP_MTIME |
+ SWAP_LAYOUTS_KEEP_ATIME));
}
static const char *const ladvise_names[] = LU_LADVISE_NAMES;