linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Sandeen <sandeen@redhat.com>
To: Dave Chinner <david@fromorbit.com>
Cc: linux-xfs <linux-xfs@vger.kernel.org>
Subject: Re: [PATCH] xfs_repair: allow '/' in attribute names
Date: Thu, 3 Jan 2019 15:27:26 -0600	[thread overview]
Message-ID: <7e3b23a4-fdb3-a23f-4339-97bae0e4a620@redhat.com> (raw)
In-Reply-To: <20190103212044.GO4205@dastard>

On 1/3/19 3:20 PM, Dave Chinner wrote:
> On Thu, Jan 03, 2019 at 01:15:56PM -0600, Eric Sandeen wrote:
>> For some reason, since the earliest days of XFS, a '/' character
>> in an extended attribute name has been treated as corruption by
>> xfs_repair.  This despite nothing in other userspace tools or the
>> kernel having this restriction.
>>
>> My best guess is that this was an unintentional leftover from
>> common code between dirs & attrs in the "da" code, and there has
>> never been a good reason for it.
>>
>> Since userspace and kernelspace allow such a name to be set,
>> listed, and read, it seems wrong to flag it as corruption.
>> So, make this test conditional on whether we're validating a name
>> in a dir, as opposed to the name of an attr.
> 
> Sounds fair.
> 
>> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
>> ---
>>
>>
>> diff --git a/repair/attr_repair.c b/repair/attr_repair.c
>> index 1d04500..2f6f7ef 100644
>> --- a/repair/attr_repair.c
>> +++ b/repair/attr_repair.c
>> @@ -292,11 +292,9 @@ process_shortform_attr(
>>  			}
>>  		}
>>  
>> -		/* namecheck checks for / and null terminated for file names.
>> -		 * attributes names currently follow the same rules.
>> -		*/
>> +		/* namecheck checks for null chars in attr names. */
>>  		if (namecheck((char *)&currententry->nameval[0],
>> -						currententry->namelen))  {
>> +						currententry->namelen, false)) {
> 
> Hmmmm. that's kinda messy. How about:
> 
> /* attr_namecheck checks for null chars in attr names. */
> bool
> attr_namecheck(
> 	uint8_t	name,
> 	int	length)
> {
> 	return namecheck((char *)name, length, false);
> }

Ok, good idea.

-Eric

  reply	other threads:[~2019-01-03 21:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-03 19:15 [PATCH] xfs_repair: allow '/' in attribute names Eric Sandeen
2019-01-03 21:20 ` Dave Chinner
2019-01-03 21:27   ` Eric Sandeen [this message]
2019-01-03 21:51     ` Darrick J. Wong
2019-01-11 23:12 ` [PATCH V2] " Eric Sandeen
2019-01-14 19:54   ` Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7e3b23a4-fdb3-a23f-4339-97bae0e4a620@redhat.com \
    --to=sandeen@redhat.com \
    --cc=david@fromorbit.com \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).