Whamcloud - gitweb
LU-16281 clio: append to non-existent component 94/48994/2
authorVitaly Fertman <c17818@cray.com>
Tue, 5 Jul 2022 21:00:58 +0000 (00:00 +0300)
committerOleg Drokin <green@whamcloud.com>
Mon, 14 Nov 2022 08:26:14 +0000 (08:26 +0000)
should return an error, but it fails now with a BUG below
because @rc of lov_io_layout_at() is not checked for < 0

BUG: unable to handle kernel paging request at ffff99d3c2f74030
    Call Trace:
      lov_stripe_number+0x19/0x40 [lov]
      lov_page_init_composite+0x103/0x5f0 [lov]
      ? kmem_cache_alloc+0x12e/0x270
      cl_page_alloc+0x19f/0x660 [obdclass]
      cl_page_find+0x1a0/0x250 [obdclass]
      ll_write_begin+0x1f7/0xfb0 [lustre]

HPE-bug-id: LUS-11075
Signed-off-by: Vitaly Fertman <vitaly.fertman@hpe.com>
Change-Id: I4371f56cd9cdb3429d52a283831fb0a768e5c9c3
Reviewed-on: https://es-gerrit.dev.cray.com/161123
Tested-by: Jenkins Build User <nssreleng@cray.com>
Reviewed-by: Alexander Zarochentsev <alexander.zarochentsev@hpe.com>
Reviewed-by: Alexander Boyko <alexander.boyko@hpe.com>
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/48994
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Alexander <alexander.boyko@hpe.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/lov/lov_page.c
lustre/tests/sanity-pfl.sh

index 44031d2..1c9cf7e 100644 (file)
@@ -84,6 +84,8 @@ int lov_page_init_composite(const struct lu_env *env, struct cl_object *obj,
                suboff = lio->lis_cached_suboff + offset - lio->lis_cached_off;
        } else {
                entry = lov_io_layout_at(lio, offset);
+               if (entry < 0)
+                       return(-ENODATA);
 
                stripe = lov_stripe_number(loo->lo_lsm, entry, offset);
                rc = lov_stripe_offset(loo->lo_lsm, entry, offset, stripe,
index 0d49ea6..33746c4 100644 (file)
@@ -2482,6 +2482,28 @@ test_25() {
 }
 run_test 25 "Verify old lov stripe API with PFL files"
 
+test_26a() {
+       $LFS setstripe -E 1m -S 1M -c 1 $DIR/$tfile
+       dd if=/dev/urandom bs=1M count=10 >> $DIR/$tfile
+       [ $? != 0 ] || error "append must return an error"
+}
+run_test 26a "Append to not-existent component"
+
+test_26b() {
+       $LFS setstripe -E 1m -S 1M -c 1 $DIR/$tfile
+       dd if=/dev/urandom bs=1M count=1 > $DIR/$tfile
+       dd if=/dev/urandom bs=1M count=1 >> $DIR/$tfile
+       [ $? != 0 ] || error "append must return an error"
+}
+run_test 26b "Append to not-existend component, file size is unknown"
+
+test_26c() {
+       $LFS setstripe -E 1m -S 1M -c 1 $DIR/$tfile
+       dd if=/dev/urandom bs=2M count=1 >> $DIR/$tfile
+       [ $? != 0 ] || error "append must return an error"
+}
+run_test 26c "Append to not-existend component, crossing the component border"
+
 complete $SECONDS
 check_and_cleanup_lustre
 exit_status