[LU-6299] OSP does not handle zero length xattr values well Created: 26/Feb/15  Updated: 01/Jul/16  Resolved: 28/May/15

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: Lustre 2.7.0
Fix Version/s: Lustre 2.8.0

Type: Bug Priority: Blocker
Reporter: John Hammond Assignee: Di Wang
Resolution: Fixed Votes: 0
Labels: None

Severity: 3
Rank (Obsolete): 17639

 Description   

The OSP/OUT code assumes that xattr values always have a non-zero length. For example,

static int out_xattr_set(struct tgt_session_info *tsi)
{
         ...
        buf = object_update_param_get(update, 1, &buf_len);
        if (buf == NULL || buf_len == 0) {
                CERROR("%s: empty buf for xattr set: rc = %d\n",
                       tgt_name(tsi->tsi_tgt), -EPROTO);
                RETURN(err_serious(-EPROTO));
        }
        ...

Here is what happens on 2.6.94-18-g7c82a9c

t:lustre-release# cd /mnt/lustre
t:lustre# lfs mkdir -c4 d0
t:lustre# setfattr -n user.foo d0

Message from syslogd@t at Feb 26 10:53:15 ...
 kernel:[  409.511761] LustreError: 4876:0:(osp_object.c:1132:__osp_xattr_set()) ASSERTION( buf->lb_len > 0 && buf->lb_buf != ((void *)0) ) failed: 

Message from syslogd@t at Feb 26 10:53:15 ...
 kernel:[  409.515616] LustreError: 4876:0:(osp_object.c:1132:__osp_xattr_set()) LBUG


 Comments   
Comment by Andreas Dilger [ 26/Feb/15 ]

It surprises me that we don't have a test for setting zero-length xattrs. Maybe we do for regular files and not directories? Please add one for this test. The sanity test_102h and test_102k seem like they are close, but don't start with a zero-length xattr, and don't run on a directory. Seems a test_102hb is needed for testing xattrs on directories.

Comment by Andreas Dilger [ 11/May/15 ]

Di, any update on this one?

Comment by Di Wang [ 11/May/15 ]

Ah, did not notice this one, will work on it today

Comment by Gerrit Updater [ 13/May/15 ]

wangdi (di.wang@intel.com) uploaded a new patch: http://review.whamcloud.com/14787
Subject: LU-6299 osp: zero-length EA xattr_set for striped_dir
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 411b1631c005fd7e80f98f56b932363b9c3e13e5

Comment by Gerrit Updater [ 28/May/15 ]

Oleg Drokin (oleg.drokin@intel.com) merged in patch http://review.whamcloud.com/14787/
Subject: LU-6299 osp: zero-length EA xattr_set for striped_dir
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 1cf0952fc28b061932cec40022486a7f78573414

Comment by Peter Jones [ 28/May/15 ]

Landed for 2.8

Generated at Sat Feb 10 01:59:01 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.