Skip to contentSkip to conversation

fs/ntfs3: Add attrib operations

PATCH Konstantin Komarov 2 participants 3 messages Aug 28, 2020 – Sep 4, 2020 VFS

lore
Share & tools
lore
#0 lore raw

From: Mark Harmstone <[email protected]> On Behalf Of Mark Harmstone
Sent: Monday, August 24, 2020 7:14 PM

Quoted 10 lines

Hi Konstantin,

I have an interest in this - I wrote the Btrfs driver for Windows, which also had to deal with the issue of how to map NTFS concept to Linux xattrs. Unless there's a good reason, I think it'd be in everyone's interests if we used the same conventions.

You have four(!) different ways of referring to the attributes value, which seems a bit excessive. I suggest you just use user.DOSATTRIB - this should be in the user namespace as users can set e.g. the hidden flag on files at will. This also matches what my driver does, and what Samba does.

Hi Mark! Thanks for the feedback. It's reasonable concern, but the open question is how to access those NTFS attributes which extend the DOS attributes. user.DOSATTRIB may be good for FAT32 as DOS attributes are stored in 8bit. However, this does not apply to NTFS (32bit attributes).

Quoted 3 lines

I also think it's a mistake to only expose user.DOSATTRIB to Samba - there's patches in Wine staging which would also benefit from this.

Agreed. Will fix this in v4. We think historically this came from wrong reading of "This extended attribute is explicitly hidden from smbd clients requesting an EA list."

Quoted 3 lines

Also, unless I'm missing something there's a bug in ntfs_setxattr - the user shouldn't be able to clear the FILE_ATTRIBUTE_DIRECTORY flag on directories nor set it on files.

Thanks! Fixed in v3.

Quoted 4 lines

Thanks

Mark

#1 lore raw
Quoted 4 lines · Konstantin Komarov

Hi Mark! Thanks for the feedback. It's reasonable concern, but the open question is how to access those NTFS attributes which extend the DOS attributes. user.DOSATTRIB may be good for FAT32 as DOS attributes are stored in 8bit. However, this does not apply to NTFS (32bit attributes).

I'm not sure why this would be an issue - the obvious way of reading user.DOSATTRIB is to use sscanf into an int, and then check for the bits you're interested in. The NT FILE_ATTRIBUTE_* values replicate and extend the FAT constants used by DOS, so it shouldn't cause any confusion only exposing the full 32-bit value.

#2 lore raw

From: Mark Harmstone <[email protected]> On Behalf Of Mark Harmstone
Sent: Saturday, August 29, 2020 3:54 PM

Quoted 11 lines · Konstantin Komarov
Quoted 4 lines

Hi Mark! Thanks for the feedback. It's reasonable concern, but the open question is how to access those NTFS attributes which extend the DOS attributes. user.DOSATTRIB may be good for FAT32 as DOS attributes are stored in 8bit. However, this does not apply to NTFS (32bit attributes).

I'm not sure why this would be an issue - the obvious way of reading user.DOSATTRIB is to use sscanf into an int, and then check for the bits you're interested in. The NT FILE_ATTRIBUTE_* values replicate and extend the FAT constants used by DOS, so it shouldn't cause any confusion only exposing the full 32-bit value.

Hi Mark! First, in v4 we've removed smbd-exclusive access to user.DOSATTRIB. Overall, we agree that unified access is preferred. If everyone is fine with sticking to user.DOSATTRIB, we'll remove other options in next patches.