Reading directory pages may fail on MDS, in this case client should
not cache a non-up-to-date directory page, because it will cause
a later read on the same page fail.
Add sanity 242 for this.
Signed-off-by: Lai Siyao <lai.siyao@intel.com>
Change-Id: Icbb55c0ecc4b88913b08ac8998c2673ec15b18ea
Reviewed-on: http://review.whamcloud.com/11450
Tested-by: Jenkins
Reviewed-by: Fan Yong <fan.yong@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
struct md_callback *rp_cb;
};
struct md_callback *rp_cb;
};
+#ifndef HAVE_DELETE_FROM_PAGE_CACHE
+static inline void delete_from_page_cache(struct page *page)
+{
+ remove_from_page_cache(page);
+ page_cache_release(page);
+}
+#endif
+
/**
* Read pages from server.
*
/**
* Read pages from server.
*
rc = mdc_getpage(rp->rp_exp, fid, rp->rp_off, op_data->op_capa1,
page_pool, npages, &req);
rc = mdc_getpage(rp->rp_exp, fid, rp->rp_off, op_data->op_capa1,
page_pool, npages, &req);
+ if (rc < 0) {
+ /* page0 is special, which was added into page cache early */
+ delete_from_page_cache(page0);
+ } else {
int lu_pgs;
rd_pgs = (req->rq_bulk->bd_nob_transferred +
int lu_pgs;
rd_pgs = (req->rq_bulk->bd_nob_transferred +
SetPageUptodate(page0);
}
SetPageUptodate(page0);
}
ptlrpc_req_finished(req);
CDEBUG(D_CACHE, "read %d/%d pages\n", rd_pgs, npages);
for (i = 1; i < npages; i++) {
ptlrpc_req_finished(req);
CDEBUG(D_CACHE, "read %d/%d pages\n", rd_pgs, npages);
for (i = 1; i < npages; i++) {
}
run_test 241 "bio vs dio"
}
run_test 241 "bio vs dio"
+test_242() {
+ mkdir -p $DIR/$tdir
+ touch $DIR/$tdir/$tfile
+
+ #define OBD_FAIL_MDS_READPAGE_PACK 0x105
+ do_facet mds1 lctl set_param fail_loc=0x105
+ /bin/ls $DIR/$tdir && error "ls $DIR/$tdir should fail"
+
+ do_facet mds1 lctl set_param fail_loc=0
+ /bin/ls $DIR/$tdir || error "ls $DIR/$tdir failed"
+}
+run_test 242 "mdt_readpage failure should not cause directory unreadable"
+
cleanup_test_300() {
trap 0
umask $SAVE_UMASK
cleanup_test_300() {
trap 0
umask $SAVE_UMASK