run_test 27e "setstripe existing file (should return error) ======"
test_27f() {
- test_mkdir -p $DIR/d27
- $SETSTRIPE -S 100 -i 0 -c 1 $DIR/d27/fbad && error "setstripe failed"
- dd if=/dev/zero of=$DIR/d27/fbad bs=4k count=4 || error "dd failed"
- $GETSTRIPE $DIR/d27/fbad || error "$GETSTRIPE failed"
+ test_mkdir $DIR/$tdir
+ $SETSTRIPE -S 100 -i 0 -c 1 $DIR/$tdir/$tfile &&
+ error "$SETSTRIPE $DIR/$tdir/$tfile failed"
+ $CHECKSTAT -t file $DIR/$tdir/$tfile &&
+ error "$CHECKSTAT -t file $DIR/$tdir/$tfile should fail"
+ dd if=/dev/zero of=$DIR/$tdir/$tfile bs=4k count=4 || error "dd failed"
+ $GETSTRIPE $DIR/$tdir/$tfile || error "$GETSTRIPE failed"
}
run_test 27f "setstripe with bad stripe size (should return error)"
int stripe_count, int stripe_pattern, char *pool_name)
{
struct lov_user_md_v3 lum = { 0 };
- int fd, rc = 0;
+ int fd = -1;
+ int rc = 0;
/* Make sure we have a good pool */
if (pool_name != NULL) {
}
}
+ rc = llapi_stripe_limit_check(stripe_size, stripe_offset, stripe_count,
+ stripe_pattern);
+ if (rc != 0)
+ return rc;
+
retry_open:
fd = open(name, flags | O_LOV_DELAY_CREATE, mode);
if (fd < 0) {
return rc;
}
- rc = llapi_stripe_limit_check(stripe_size, stripe_offset, stripe_count,
- stripe_pattern);
- if (rc != 0)
- goto out;
-
/* Initialize IOCTL striping pattern structure */
lum.lmm_magic = LOV_USER_MAGIC_V3;
lum.lmm_pattern = stripe_pattern;
"error on ioctl "LPX64" for '%s' (%d): %s",
(__u64)LL_IOC_LOV_SETSTRIPE, name, fd,errmsg);
}
-out:
- if (rc) {
- close(fd);
- fd = rc;
- }
- return fd;
+ if (rc) {
+ close(fd);
+ fd = rc;
+ }
+
+ return fd;
}
int llapi_file_open(const char *name, int flags, int mode,