Commit af49e96b authored by Mikhail Pershin's avatar Mikhail Pershin Committed by Oleg Drokin
Browse files

LU-12014 llite: check correct size in ll_dom_finish_open()

The check in ll_dom_finish_open() for data end shouldn't
use i_size for comparision because it may be not updated
yet with just returned data from server. Use size value in
mdt_body from reply for that check.

Lustre-change: https://review.whamcloud.com/33895
Lustre-commit: 7b9fd576

Signed-off-by: default avatarMikhail Pershin <mpershin@whamcloud.com>
Change-Id: I1104fbbb0eb4633869b9bf2d1803ac3e84e3853d
Reviewed-on: https://review.whamcloud.com/40301

Tested-by: default avatarjenkins <devops@whamcloud.com>
Tested-by: default avatarMaloo <maloo@whamcloud.com>
Reviewed-by: default avatarAndreas Dilger <adilger@whamcloud.com>
Reviewed-by: default avatarOleg Drokin <green@whamcloud.com>
parent 98ee0d5b
......@@ -415,6 +415,7 @@ void ll_dom_finish_open(struct inode *inode, struct ptlrpc_request *req,
struct address_space *mapping = inode->i_mapping;
struct page *vmpage;
struct niobuf_remote *rnb;
struct mdt_body *body;
char *data;
struct lustre_handle lockh;
struct ldlm_lock *lock;
......@@ -453,18 +454,19 @@ void ll_dom_finish_open(struct inode *inode, struct ptlrpc_request *req,
if (rnb->rnb_offset % PAGE_SIZE)
RETURN_EXIT;
/* Server returns whole file or just file tail if it fills in
* reply buffer, in both cases total size should be inode size.
/* Server returns whole file or just file tail if it fills in reply
* buffer, in both cases total size should be equal to the file size.
*/
if (rnb->rnb_offset + rnb->rnb_len < i_size_read(inode)) {
CERROR("%s: server returns off/len %llu/%u < i_size %llu\n",
body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
if (rnb->rnb_offset + rnb->rnb_len != body->mbo_dom_size) {
CERROR("%s: server returns off/len %llu/%u but size %llu\n",
ll_get_fsname(inode->i_sb, NULL, 0), rnb->rnb_offset,
rnb->rnb_len, i_size_read(inode));
rnb->rnb_len, body->mbo_dom_size);
RETURN_EXIT;
}
CDEBUG(D_INFO, "Get data along with open at %llu len %i, i_size %llu\n",
rnb->rnb_offset, rnb->rnb_len, i_size_read(inode));
CDEBUG(D_INFO, "Get data along with open at %llu len %i, size %llu\n",
rnb->rnb_offset, rnb->rnb_len, body->mbo_dom_size);
data = (char *)rnb + sizeof(*rnb);
......
......@@ -4449,7 +4449,7 @@ run_test 93 "alloc_rr should not allocate on same ost"
test_100a() {
skip "Reserved for glimpse-ahead" && return
[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.55) ] &&
skip "Need MDS version at least 2.10.55" && return
skip "Need MDS version at least 2.10.55"
mkdir -p $DIR/$tdir
......@@ -4473,7 +4473,7 @@ run_test 100a "DoM: glimpse RPCs for stat without IO lock (DoM only file)"
test_100b() {
[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.55) ] &&
skip "Need MDS version at least 2.10.55" && return
skip "Need MDS version at least 2.10.55"
mkdir -p $DIR/$tdir
......@@ -4496,7 +4496,7 @@ run_test 100b "DoM: no glimpse RPC for stat with IO lock (DoM only file)"
test_100c() {
[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.55) ] &&
skip "Need MDS version at least 2.10.55" && return
skip "Need MDS version at least 2.10.55"
mkdir -p $DIR/$tdir
......@@ -4519,7 +4519,7 @@ run_test 100c "DoM: write vs stat without IO lock (combined file)"
test_100d() {
[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.55) ] &&
skip "Need MDS version at least 2.10.55" && return
skip "Need MDS version at least 2.10.55"
mkdir -p $DIR/$tdir
......@@ -4542,6 +4542,28 @@ test_100d() {
}
run_test 100d "DoM: write+truncate vs stat without IO lock (combined file)"
test_100e() {
[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.11.50) ] &&
skip "Need MDS version at least 2.11.50"
local dom=$DIR/$tdir/dom
local dom2=$DIR2/$tdir/dom
mkdir -p $DIR/$tdir
$LFS setstripe -E 1024K -L mdt $DIR/$tdir
cancel_lru_locks mdc
dd if=/dev/urandom of=$dom bs=12000 count=1
$TRUNCATE $dom2 6000
cancel_lru_locks mdc
lctl set_param -n mdc.*.stats=clear
# expect read-on-open to return all data before write
cat /etc/hosts >> $dom
local read=$(lctl get_param -n mdc.*.stats | grep -c ost_read)
[[ $read -eq 0 ]] || error "Unexpected $read READ RPCs"
}
run_test 100e "DoM: read on open and file size"
test_101a() {
[ $(lustre_version_code $SINGLEMDS) -lt $(version_code 2.10.55) ] &&
skip "Need MDS version at least 2.10.55" && return
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment