Received: from oss.sgi.com (localhost [127.0.0.1]) by oss.sgi.com (8.12.3/8.12.3) with ESMTP id g4Q52onC007330 for ; Sat, 25 May 2002 22:02:50 -0700 Received: (from majordomo@localhost) by oss.sgi.com (8.12.3/8.12.3/Submit) id g4Q52oqm007329 for linux-xfs-outgoing; Sat, 25 May 2002 22:02:50 -0700 X-Authentication-Warning: oss.sgi.com: majordomo set sender to owner-linux-xfs@oss.sgi.com using -f Received: from srv.dmz.us.mvd (namodn.com [209.0.100.50] (may be forged)) by oss.sgi.com (8.12.3/8.12.3) with SMTP id g4Q52XnC007300 for ; Sat, 25 May 2002 22:02:34 -0700 Received: from test2 (unknown [210.72.245.13]) by srv.dmz.us.mvd (Postfix) with SMTP id 6EA80B66E for ; Sat, 25 May 2002 22:03:43 -0700 (PDT) From: "Tang Lingbo (Allan)" To: "Linux-Xfs" Subject: EA bug while convert from INLINE to EXTENT with XATTR_REPLACE Date: Sun, 26 May 2002 13:03:40 +0800 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0000_01C204B5.C17F1CC0" X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 Sender: owner-linux-xfs@oss.sgi.com Precedence: bulk This is a multi-part message in MIME format. ------=_NextPart_000_0000_01C204B5.C17F1CC0 Content-Type: text/plain; charset="gb2312" Content-Transfer-Encoding: base64 SGksDQoNCk9uZSBvZiB0aGUgYXR0YWNoZWQgZmlsZXMgaXMgdXNlZCB0byBo aXQgdGhlIGJ1ZyBhcyBmb2xsb3dpbmcsIHRoZSBwYXRjaCBpcw0KbXkgc29s dXRpb246DQoNCkEuIHNldCBhIEVBIHdpdGggMTAgY2hhcnMgKG5hbWUgbGVu Z3RoICsgdmFsdWUgbGVuZ3RoKSANCkIuIGNoYW5nZSBhYm92ZSBuYW1lJ3Mg dmFsdWUgd2l0aCBjaGFycyBtb3JlIHRoYW4gMzIgDQoNCklmIHdlIHVzZWQg dGhlIEVBIHRocm91Z2ggbGliLCB0aGUgb3BlcmF0aW9ucyBzZWVtcyBPSyBi ZWNhdXNlIGl0DQpoYXMgbmV2ZXIgdXNlZCBYQVRUUl9SRVBMQUNFIGZsYWcu DQoNClRoZSBwYXRjaCB3aWxsIHNvbHZlIHRoZSBwcm9ibGVtLg0KDQpSZWdh cmRzLA0KQWxsYW4= ------=_NextPart_000_0000_01C204B5.C17F1CC0 Content-Type: application/octet-stream; name="attr_test.c" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="attr_test.c" #include #include #include #include #include #include #include #include #include extern int errno; #define XATTR_NAME "xfsroot." int main(int argc, char **argv) { int ret, size =3D 255, flags; char *filename, xattrname[256], *xattrval, val[256]; if (argc !=3D 4) { fprintf(stderr, "Usage: %s \n", basename(argv[0])); exit(1); } memset(val, 0x00, 256); memset(xattrname, 0x00, 256); filename =3D argv[1]; strcpy(xattrname, XATTR_NAME); strcat(xattrname, argv[2]); xattrval =3D argv[3]; =09 ret =3D getxattr(filename, xattrname, val, size); if (ret >=3D 0) { flags =3D XATTR_REPLACE; } else if (errno =3D=3D ENOATTR) { flags =3D XATTR_CREATE; } else { fprintf(stderr, "getxattr failed (error %d)\n", errno); exit(1); } ret =3D setxattr(filename, xattrname, xattrval, strlen(xattrval), flags); if (ret =3D=3D -1) { fprintf(stderr, "setxattr failed (error %d)\n", errno); exit(1); } return 0; } ------=_NextPart_000_0000_01C204B5.C17F1CC0 Content-Type: application/octet-stream; name="xfs_attr.c.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="xfs_attr.c.patch" Index: fs/xfs/xfs_attr.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /home/cvs/sync/linux-2.4.18-xfs-1.1/fs/xfs/xfs_attr.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 xfs_attr.c --- fs/xfs/xfs_attr.c 8 May 2002 03:49:53 -0000 1.1.1.1 +++ fs/xfs/xfs_attr.c 26 May 2002 04:40:40 -0000 @@ -792,15 +792,20 @@ } else if (retval =3D=3D EEXIST) { if (args->flags & ATTR_CREATE) return(retval); - retval =3D xfs_attr_shortform_remove(args); +/* retval =3D xfs_attr_shortform_remove(args); ASSERT(retval =3D=3D 0); - } +*/ } =20 newsize =3D XFS_ATTR_SF_TOTSIZE(args->dp); newsize +=3D XFS_ATTR_SF_ENTSIZE_BYNAME(args->namelen, args->valuelen); + if ((newsize <=3D XFS_IFORK_ASIZE(args->dp)) && (args->namelen < XFS_ATTR_SF_ENTSIZE_MAX) && (args->valuelen < XFS_ATTR_SF_ENTSIZE_MAX)) { + if ((args->flags & ATTR_REPLACE) && (retval =3D=3D ENOATTR)) { + retval =3D xfs_attr_shortform_remove(args); + ASSERT(retval =3D=3D 0); + } retval =3D xfs_attr_shortform_add(args); ASSERT(retval =3D=3D 0); } else { ------=_NextPart_000_0000_01C204B5.C17F1CC0--