* on-disk symlinks for ldiskfs.
*/
if (S_ISLNK(dt->do_lu.lo_header->loh_attr) &&
- (buf->lb_len <= sizeof(LDISKFS_I(inode)->i_data)))
+ (buf->lb_len < sizeof(LDISKFS_I(inode)->i_data)))
rc = osd_ldiskfs_readlink(inode, buf->lb_buf, buf->lb_len);
else
rc = osd_ldiskfs_read(inode, buf->lb_buf, buf->lb_len, pos);
}
run_test 17f "symlinks: long and very long symlink name ========================"
+# str_repeat(S, N) generate a string that is string S repeated N times
+str_repeat() {
+ local s=$1
+ local n=$2
+ local ret=''
+ while [ $((n -= 1)) -ge 0 ]; do
+ ret=$ret$s
+ done
+ echo $ret
+}
+
+# Long symlinks and LU-2241
test_17g() {
- mkdir -p $DIR/$tdir
- LONGSYMLINK="$(dd if=/dev/zero bs=4095 count=1 | tr '\0' 'x')"
- ln -s $LONGSYMLINK $DIR/$tdir/$tfile
- ls -l $DIR/$tdir
+ mkdir -p $DIR/$tdir
+ local TESTS="59 60 61 4094 4095"
+
+ for i in $TESTS; do
+ local SYMNAME=$(str_repeat 'x' $i)
+ ln -s $SYMNAME $DIR/$tdir/f$i || error "failed $i-char symlink"
+ readlink $DIR/$tdir/f$i || error "failed $i-char readlink"
+ done
}
-run_test 17g "symlinks: really long symlink name ==============================="
+run_test 17g "symlinks: really long symlink name and inode boundaries"
test_17h() { #bug 17378
remote_mds_nodsh && skip "remote MDS with nodsh" && return