Re: [PATCH] ntfs: remove empty EA attribute pair
Hyunchul Lee <[email protected]> Fri, 17 Jul 2026 07:26:45 +0900
| Newsgroups | dev.linux.lists.ntfs,org.kernel.vger.linux-fsdevel |
|---|---|
| Message-ID | <CANFS6bbLi90E0YkYZ3+6GDTDL8hYNFra1Au3wvN+Wu1Tx=TWDg@mail.gmail.com> |
2026=EB=85=84 7=EC=9B=94 16=EC=9D=BC (=EB=AA=A9) =EC=98=A4=EC=A0=84 11:47, = Namjae Jeon <[email protected]>=EB=8B=98=EC=9D=B4 =EC=9E=91=EC=84=B1: > > Removing the final xattr leaves an empty $EA stream. An empty $EA > attribute paired with $EA_INFORMATION is not a valid EA chain and > ntfsck reports it as corrupt. > > Remove both attributes when the final EA entry is deleted. > > Fixes: fc053f05ca28 ("ntfs: add reparse and ea operations") > Signed-off-by: Namjae Jeon <[email protected]> Looks good to me. Reviewed-by: Hyunchul Lee <[email protected]> > --- > fs/ntfs/ea.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/fs/ntfs/ea.c b/fs/ntfs/ea.c > index 0eba3f41c7bb..88bfd6560692 100644 > --- a/fs/ntfs/ea.c > +++ b/fs/ntfs/ea.c > @@ -275,6 +275,15 @@ static int ntfs_set_ea(struct inode *inode, const ch= ar *name, size_t name_len, > ea_info_qsize -=3D ea_size; > p_ea_info->ea_query_length =3D cpu_to_le32(ea_info_qsize)= ; > > + if ((flags & XATTR_REPLACE) && !val_size && !ea_info_qsiz= e) { > + err =3D ntfs_attr_remove(ni, AT_EA, AT_UNNAMED, 0= ); > + if (err) > + goto out; > + > + err =3D ntfs_attr_remove(ni, AT_EA_INFORMATION, A= T_UNNAMED, 0); > + goto out; > + } > + > err =3D ntfs_write_ea(ni, AT_EA_INFORMATION, (char *)p_ea= _info, 0, > sizeof(struct ea_information), false); > if (err) > -- > 2.25.1 > --=20 Thanks, Hyunchul