Whamcloud - gitweb
b=22301 lustre.lov error when backing up symlinks with extended attributes
authorDmitry Zogin <dmitry.zoguine@oracle.com>
Fri, 6 Aug 2010 17:10:26 +0000 (21:10 +0400)
committerMikhail Pershin <tappro@sun.com>
Fri, 13 Aug 2010 06:48:18 +0000 (10:48 +0400)
 Improved logic in ll_listxattr()

 i=tom.wang
 i=dmitry.zogin

 sanity test_17k created

 o=grev
 i=dmitry.zogin

lustre/llite/xattr.c
lustre/tests/sanity.sh

index 2dc57cb..668e3dc 100644 (file)
@@ -481,6 +481,8 @@ ssize_t ll_listxattr(struct dentry *dentry, char *buffer, size_t size)
         ll_stats_ops_tally(ll_i2sbi(inode), LPROC_LL_LISTXATTR, 1);
 
         rc = ll_getxattr_common(inode, NULL, buffer, size, OBD_MD_FLXATTRLS);
+        if (rc < 0)
+                GOTO(out, rc);
 
         if (S_ISREG(inode->i_mode)) {
                 struct ll_inode_info *lli = ll_i2info(inode);
@@ -494,7 +496,7 @@ ssize_t ll_listxattr(struct dentry *dentry, char *buffer, size_t size)
 
         if (rc2 < 0) {
                 GOTO(out, rc2 = 0);
-        } else {
+        } else if (S_ISREG(inode->i_mode) || S_ISDIR(inode->i_mode)) {
                 const int prefix_len = sizeof(XATTR_LUSTRE_PREFIX) - 1;
                 const size_t name_len   = sizeof("lov") - 1;
                 const size_t total_len  = prefix_len + name_len + 1;
index 4b70d66..4dd6297 100755 (executable)
@@ -493,6 +493,17 @@ test_17i() { #bug 20018
 }
 run_test 17i "don't panic on short symlink"
 
+test_17k() { #bug 22301
+        rsync --help | grep -q xattr ||
+                skip_env "$(rsync --version| head -1) does not support xattrs"
+        mkdir -p $DIR/{$tdir,$tdir.new}
+        touch $DIR/$tdir/$tfile
+        ln -s $DIR/$tdir/$tfile $DIR/$tdir/$tfile.lnk
+        rsync -av -X $DIR/$tdir/ $DIR/$tdir.new ||
+                error "rsync failed with xattrs enabled"
+}
+run_test 17k "symlinks: rsync with xattrs enabled ========================="
+
 test_18() {
        touch $DIR/f
        ls $DIR || error