Whamcloud - gitweb
LU-279 Test failure on test suite sanity, subtest test_17k
authorBobi Jam <bobijam@whamcloud.com>
Tue, 10 May 2011 03:14:15 +0000 (11:14 +0800)
committerOleg Drokin <green@whamcloud.com>
Sat, 14 May 2011 00:47:10 +0000 (17:47 -0700)
rsync 3.0.x cares about exact xattr value size when passing 0 size
for determining the buffer size to hold the xattr value.

Change-Id: I05f8c062e64e22dd6982dc752d5869b457c7a2ef
Signed-off-by: Bobi Jam <bobijam@whamcloud.com>
Reviewed-on: http://review.whamcloud.com/524
Tested-by: Hudson
Reviewed-by: Johann Lombardi <johann@whamcloud.com>
Reviewed-by: Prakash Surya <surya1@llnl.gov>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/llite/xattr.c

index 567cd82..94b48bf 100644 (file)
@@ -435,12 +435,10 @@ ssize_t ll_getxattr(struct dentry *dentry, const char *name,
                 if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode))
                         return -ENODATA;
 
                 if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode))
                         return -ENODATA;
 
-                if (size == 0) {
-                        /* size == 0 just ask for buffer size */
-                        rc = ll_get_max_mdsize(ll_i2sbi(inode), &lmmsize);
-                        if (rc == 0)
-                                rc = lmmsize;
-                        GOTO(out, rc);
+                if (size == 0 && S_ISDIR(inode->i_mode)) {
+                        /* XXX directory EA is fix for now, optimize to save
+                         * RPC transfer */
+                        GOTO(out, rc = sizeof(struct lov_user_md));
                 }
 
                 if (!ll_i2info(inode)->lli_smd) {
                 }
 
                 if (!ll_i2info(inode)->lli_smd) {
@@ -461,6 +459,15 @@ ssize_t ll_getxattr(struct dentry *dentry, const char *name,
                 if (rc < 0)
                        GOTO(out, rc);
 
                 if (rc < 0)
                        GOTO(out, rc);
 
+                if (size == 0) {
+                        /* used to call ll_get_max_mdsize() forward to get
+                         * the maximum buffer size, while some apps (such as
+                         * rsync 3.0.x) care much about the exact xattr value
+                         * size */
+                        rc = lmmsize;
+                        GOTO(out, rc);
+                }
+
                 if (size < lmmsize) {
                         CERROR("server bug: replied size %d > %d for %s (%s)\n",
                                lmmsize, (int)size, dentry->d_name.name, name);
                 if (size < lmmsize) {
                         CERROR("server bug: replied size %d > %d for %s (%s)\n",
                                lmmsize, (int)size, dentry->d_name.name, name);