diff --git a/lustre/ChangeLog b/lustre/ChangeLog index b103215244da83ede53d15e961d3d9ae03813fca..ba4bb86061bb2118befb2fe0fd5050d0b994ffd6 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -163,13 +163,6 @@ Description: random memory corruption Details : size of struct ll_inode_info is to big for union inode.u and this can be cause of random memory corruption. -Severity : normal -Bugzilla : 11737 -Description: Short directio read returns full requested size rather than - actual amount read. -Details : Direct I/O operations should return actual amount of bytes - transferred rather than requested size. - Severity : normal Frequency : rare Bugzilla : 10818 diff --git a/lustre/include/lustre_net.h b/lustre/include/lustre_net.h index fc731cb206ebd526fc643b16aa440eefdbb62e10..e6e7d21071c58b446fa175ce3afc5edc008931b1 100644 --- a/lustre/include/lustre_net.h +++ b/lustre/include/lustre_net.h @@ -181,8 +181,6 @@ struct ptlrpc_request_set { struct list_head set_requests; set_interpreter_func set_interpret; /* completion callback */ void *set_arg; /* completion context */ - void *set_countp; /* pointer to NOB counter in case - * of directIO (bug11737) */ /* locked so that any old caller can communicate requests to * the set holder who can then fold them into the lock-free set */ spinlock_t set_new_req_lock; diff --git a/lustre/include/obd_class.h b/lustre/include/obd_class.h index f77c3996dd74b5c3fe3490c80f043915dad92459..d7964055ccbd40c3b46aed92d6c2767f5784909f 100644 --- a/lustre/include/obd_class.h +++ b/lustre/include/obd_class.h @@ -911,15 +911,12 @@ static inline int obd_brw_rqset(int cmd, struct obd_export *exp, { struct ptlrpc_request_set *set = NULL; struct obd_info oinfo = { { { 0 } } }; - atomic_t nob; int rc = 0; ENTRY; set = ptlrpc_prep_set(); if (set == NULL) RETURN(-ENOMEM); - atomic_set(&nob, 0); - set->set_countp = &nob; oinfo.oi_oa = oa; oinfo.oi_md = lsm; @@ -928,8 +925,6 @@ static inline int obd_brw_rqset(int cmd, struct obd_export *exp, rc = ptlrpc_set_wait(set); if (rc) CERROR("error from callback: rc = %d\n", rc); - else - rc = atomic_read(&nob); } else { CDEBUG(rc == -ENOSPC ? D_INODE : D_ERROR, "error from obd_brw_async: rc = %d\n", rc); diff --git a/lustre/llite/rw24.c b/lustre/llite/rw24.c index 646dedcc94ba7f5275179d723fe9fc872f5913d0..508636bd08f6416b2a69b2a1e8e1a41625dffde2 100644 --- a/lustre/llite/rw24.c +++ b/lustre/llite/rw24.c @@ -66,14 +66,13 @@ static int ll_direct_IO_24(int rw, struct brw_page *pga; struct obdo oa; int length, i, flags, rc = 0; - loff_t offset, offset_orig; + loff_t offset; ENTRY; if (!lsm || !lsm->lsm_object_id) RETURN(-EBADF); offset = ((obd_off)blocknr << inode->i_blkbits); - offset_orig = offset; CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p), size="LPSZ ", offset=%lld=%llx, pages %u\n", inode->i_ino, inode->i_generation, inode, iobuf->length, @@ -114,10 +113,13 @@ static int ll_direct_IO_24(int rw, LPROC_LL_DIRECT_READ, iobuf->length); rc = obd_brw_rqset(rw, ll_i2obdexp(inode), &oa, lsm, iobuf->nr_pages, pga, NULL); - if ((rc > 0) && (rw == OBD_BRW_WRITE)) { - lov_stripe_lock(lsm); - obd_adjust_kms(ll_i2obdexp(inode), lsm, offset_orig + rc, 0); - lov_stripe_unlock(lsm); + if (rc == 0) { + rc = iobuf->length; + if (rw == OBD_BRW_WRITE) { + lov_stripe_lock(lsm); + obd_adjust_kms(ll_i2obdexp(inode), lsm, offset, 0); + lov_stripe_unlock(lsm); + } } OBD_FREE(pga, sizeof(*pga) * iobuf->nr_pages); diff --git a/lustre/llite/rw26.c b/lustre/llite/rw26.c index eac8c84fee2347a27ec75fa7ed1f038525d3f3f8..4fb767f00cf43a880c3a2e85fe4380be63f6ed98 100644 --- a/lustre/llite/rw26.c +++ b/lustre/llite/rw26.c @@ -141,7 +141,6 @@ static ssize_t ll_direct_IO_26_seg(int rw, struct inode *inode, struct obdo oa; int i, rc = 0; size_t length; - loff_t file_offset_orig = file_offset; ENTRY; OBD_ALLOC(pga, sizeof(*pga) * page_count); @@ -167,10 +166,13 @@ static ssize_t ll_direct_IO_26_seg(int rw, struct inode *inode, rc = obd_brw_rqset(rw == WRITE ? OBD_BRW_WRITE : OBD_BRW_READ, ll_i2obdexp(inode), &oa, lsm, page_count, pga, NULL); - if ((rc > 0) && (rw == WRITE)) { - lov_stripe_lock(lsm); - obd_adjust_kms(ll_i2obdexp(inode), lsm, file_offset_orig + rc, 0); - lov_stripe_unlock(lsm); + if (rc == 0) { + rc = size; + if (rw == WRITE) { + lov_stripe_lock(lsm); + obd_adjust_kms(ll_i2obdexp(inode), lsm, file_offset, 0); + lov_stripe_unlock(lsm); + } } OBD_FREE(pga, sizeof(*pga) * page_count); diff --git a/lustre/osc/osc_request.c b/lustre/osc/osc_request.c index 31e7e398327de085e5bddbd2545a88afb6614d54..3d2a6eb9e7f4a8add02eb1fccb0db91d59a360de 100644 --- a/lustre/osc/osc_request.c +++ b/lustre/osc/osc_request.c @@ -1086,9 +1086,6 @@ static int osc_brw_fini_request(struct ptlrpc_request *req, int rc) if (rc < 0) RETURN(rc); - if (req->rq_set && req->rq_set->set_countp) - atomic_add(rc, (atomic_t *)req->rq_set->set_countp); - if (unlikely(aa->aa_oa->o_valid & OBD_MD_FLCKSUM)) client_cksum = aa->aa_oa->o_cksum; /* save for later */ diff --git a/lustre/tests/directio.c b/lustre/tests/directio.c index ebcedb2c781063e69a3716234228b480efd27622..b68bd74aaf07630f649a3898a6d18b95a0773387 100644 --- a/lustre/tests/directio.c +++ b/lustre/tests/directio.c @@ -106,7 +106,7 @@ int main(int argc, char **argv) rc = read(fd, rbuf, len); if (rc != len) { - printf("Read error: %s rc = %d\n",strerror(errno),rc); + printf("Read error: %s (rc = %d)\n",strerror(errno),rc); return 1; } diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 759e7cb5365a98bb2d72bebe1831db7110b75609..0d71a9056d5a419feccd9f187b3bbc93d18873ab 100644 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -3796,20 +3796,6 @@ test_118() #bug 11710 } run_test 118 "verify O_SYNC work" -test_119() # bug 11737 -{ - dd if=/dev/zero of=$DIR/$tfile bs=4k count=2 - sync - # we ask to read 3 blocks -- more than a file size - NOB=`directio read $DIR/$tfile 0 3 | awk '/error/ {print $6}'` - # check if we have read num of bytes not equal to file size (8k) - if [ "$NOB" != "8192" ]; then - error "read $NOB bytes instead of 8192" - fi - rm -f $DIR/$tfile -} -run_test 119 "Short directIO read must return actual read amount" - TMPDIR=$OLDTMPDIR TMP=$OLDTMP HOME=$OLDHOME