From acc60006f337eb53958538bbbfda9f625c1ede28 Mon Sep 17 00:00:00 2001 From: Dmitry Zogin Date: Fri, 6 Aug 2010 21:10:26 +0400 Subject: [PATCH] b=22301 lustre.lov error when backing up symlinks with extended attributes Improved logic in ll_listxattr() i=tom.wang i=dmitry.zogin sanity test_17k created o=grev i=dmitry.zogin --- lustre/llite/xattr.c | 4 +++- lustre/tests/sanity.sh | 11 +++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lustre/llite/xattr.c b/lustre/llite/xattr.c index 2dc57cb..668e3dc 100644 --- a/lustre/llite/xattr.c +++ b/lustre/llite/xattr.c @@ -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; diff --git a/lustre/tests/sanity.sh b/lustre/tests/sanity.sh index 4b70d66..4dd6297 100755 --- a/lustre/tests/sanity.sh +++ b/lustre/tests/sanity.sh @@ -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 -- 1.8.3.1