Bug 561855

Summary: [RFE] support for "lustre.*" extended attributes
Product: [Fedora] Fedora Reporter: Kamil Dudka <kdudka>
Component: tarAssignee: Kamil Dudka <kdudka>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: rawhideCC: adilger.redhat, kdudka, ovasik
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: tar-1.22-16.fc14 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 572442 (view as bug list) Environment:
Last Closed: 2010-02-20 13:11:02 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 572442    
Attachments:
Description Flags
[PATCH 1/2] xattrs: add support for lustre attributes
none
[PATCH 2/2] xattrs: set attributes before extracting a file
none
extract xattrs before writing file data
none
extract xattrs before writing file data
kdudka: review-
allow lustre.* extended attributes to be backed up and restored
kdudka: review+
[v2] extract xattrs before writing file data
none
up2date version of the xattrs patch in Fedora none

Description Kamil Dudka 2010-02-04 14:27:37 UTC
Description of problem:
This bug is opened to review a patch written by Andreas Dilger.  The patch adds support for save/restore of "lustre.*" extended attributes.  Additionally it ensures the attributes are set before a file is extracted.


Actual results:
The patch is not applied in Fedora, nor in upstream.


Expected results:
The patch is reviewed and applied.


Additional info:
I've updated the patch against the current sources of Fedora tar and split it into two pieces.

Comment 1 Kamil Dudka 2010-02-04 14:28:26 UTC
Created attachment 388800 [details]
[PATCH 1/2] xattrs: add support for lustre attributes

Comment 2 Kamil Dudka 2010-02-04 14:29:01 UTC
Created attachment 388801 [details]
[PATCH 2/2] xattrs: set attributes before extracting a file

Comment 3 Kamil Dudka 2010-02-04 14:30:40 UTC
Andreas, could you please have a look at the patches?

Do they still work for you?

Do we have any test case for them?

Thanks in advance!

Comment 4 Andreas Dilger 2010-02-05 08:11:02 UTC
Created attachment 389010 [details]
extract xattrs before writing file data

Attached is the current version of the extract xattrs first patch, with a few cleanups over the one you had.

Comment 5 Andreas Dilger 2010-02-05 08:13:54 UTC
Created attachment 389012 [details]
extract xattrs before writing file data

Comment 6 Andreas Dilger 2010-02-05 08:16:08 UTC
Created attachment 389013 [details]
allow lustre.* extended attributes to be backed up and restored

Updated version of the xattr-lustre patch.  The one attached to this bug failed to handle the lustre attributes correctly.

Comment 7 Kamil Dudka 2010-02-12 09:20:51 UTC
Comment on attachment 389013 [details]
allow lustre.* extended attributes to be backed up and restored

>--- tar-1.22.sun1.orig/src/xheader.c
>+++ tar-1.22.sun1/src/xheader.c
>@@ -1677,9 +1677,10 @@ struct xhdr_tab const xhdr_tab[] = {
>   { "SCHILY.xattr.system.posix_acl_default",
>     xattr_acls_d_coder, xattr_acls_d_decoder, false, false },
> 
>-  /* xattr's, use the star format note we only save the user/trusted varients... */
>+  /* xattrs use the star format.  note we only save some variants... */
>   { "SCHILY.xattr.user",    xattr_coder, xattr_decoder, false, true },
>   { "SCHILY.xattr.trusted", xattr_coder, xattr_decoder, false, true },
>+  { "SCHILY.xattr.lustre",  xattr_coder, xattr_decoder, false, true },
> 
>   /* ignore everything else in the xattr namespaces... */
>   { "SCHILY.xattr",         dummy_coder, dummy_decoder, false, true },

The above is the only change on top of the attachment #388800 [details].

Over all the patch looks good to me, granting r+.

Comment 8 Kamil Dudka 2010-02-12 09:31:56 UTC
Comment on attachment 389012 [details]
extract xattrs before writing file data

>--- tar-1.22.sun1.orig/src/extract.c
>+++ tar-1.22.sun1/src/extract.c
>@@ -297,7 +297,6 @@ set_stat (char const *file_name,
> 
>   xattrs_acls_set(st, file_name, typeflag);
>   xattrs_selinux_set(st, file_name, typeflag);
>-  xattrs_xattrs_set(st, file_name, typeflag);

I'll need to test the above whether it's still safe.  There have been several changes in handling xattrs/selinux for symlinks etc. in the meantime.

>-		  | (old_files_option == OVERWRITE_OLD_FILES
>-		     ? O_TRUNC
>-		     : O_EXCL));
>+		 | (old_files_option == OVERWRITE_OLD_FILES
>+		   ? O_TRUNC
>+		   : O_EXCL));

The above ^^^ changes only indentation for no reason.

>@@ -817,8 +845,18 @@ extract_file (char *file_name, int typef
>     }
>   else
>     {
>+      int file_created = 0;
>+      if (set_xattr (file_name, &current_stat_info, invert_permissions,
>+    	             typeflag, &file_created))

A tab is embedded in the line above ^^^.

Comment 9 Kamil Dudka 2010-02-12 10:30:20 UTC
Comment on attachment 389012 [details]
extract xattrs before writing file data

>--- tar-1.22.sun1.orig/src/extract.c
>+++ tar-1.22.sun1/src/extract.c
>@@ -297,7 +297,6 @@ set_stat (char const *file_name,
> 
>   xattrs_acls_set(st, file_name, typeflag);
>   xattrs_selinux_set(st, file_name, typeflag);
>-  xattrs_xattrs_set(st, file_name, typeflag);

r-, the above breaks restoring of xattrs for directories.

Could we just keep the line there?

Comment 10 Andreas Dilger 2010-02-16 23:07:03 UTC
(In reply to comment #9)
> (From update of attachment 389012 [details])
> >--- tar-1.22.sun1.orig/src/extract.c
> >+++ tar-1.22.sun1/src/extract.c
> >@@ -297,7 +297,6 @@ set_stat (char const *file_name,
> > 
> >   xattrs_acls_set(st, file_name, typeflag);
> >   xattrs_selinux_set(st, file_name, typeflag);
> >-  xattrs_xattrs_set(st, file_name, typeflag);
> 
> r-, the above breaks restoring of xattrs for directories.
> 
> Could we just keep the line there?    

That would probably work - in some cases the xattrs will
be set twice, but at least for Lustre I don't think this
will cause a problem (it will silently ignore the xattrs
that cannot be changed after file creation).

Comment 11 Kamil Dudka 2010-02-17 12:21:14 UTC
Created attachment 394722 [details]
[v2] extract xattrs before writing file data

Andreas, could you please have a look at the new version of the patch?

Comment 12 Kamil Dudka 2010-02-20 13:04:45 UTC
Created attachment 395254 [details]
up2date version of the xattrs patch in Fedora

(including both of the patches above)

Comment 13 Kamil Dudka 2010-02-20 13:11:02 UTC
built as tar-1.22-16.fc14

Comment 14 Andreas Dilger 2014-06-16 19:35:29 UTC
Comment on attachment 394722 [details]
[v2] extract xattrs before writing file data

This version of the patch is obsolete, yet I'm being asked every week to review the patch and I'm not able to mark the patch '+' or remove my review request.

Comment 15 Kamil Dudka 2014-06-16 20:16:55 UTC
Comment on attachment 394722 [details]
[v2] extract xattrs before writing file data

I am canceling the review request.  Sorry about the inconveniences.