ntfs3: fix symlinks cannot be handled correctly
PATCH 1/2 ntfs3: fix symlinks cannot be handled correctly
The symlinks created in windows will be broken in linux by ntfs3, the patch fixes it.
Signed-off-by Rong Zhang <[email protected]>
--- fs/ntfs3/dir.c | 3 +-- fs/ntfs3/frecord.c | 20 +++++++++++++++----- fs/ntfs3/inode.c | 42 ++++++++++++++++++++++-------------------- fs/ntfs3/ntfs.h | 3 +-- fs/ntfs3/ntfs_fs.h | 2 +- fs/ntfs3/xattr.c | 6 +++--- 6 files changed, 43 insertions(+), 33 deletions(-)
fs/ntfs3/dir.c +1 -2
@@ -329,8 +329,7 @@ static inline bool ntfs_dir_emit(struct ntfs_sb_info *sbi,* It does additional locks/reads just to get the type of name. * Should we use additional mount option to enable branch below? */ -if (((fname->dup.fa &FILE_ATTRIBUTE_REPARSE_POINT ) || - fname->dup.ea_size) && +if (fname->dup.extend_data && ino != ni->mi.rno) {struct inode *inode =ntfs_iget5 (sbi->sb, &e->ref,NULL );if (!IS_ERR_OR_NULL (inode)) {
fs/ntfs3/frecord.c +15 -5
@@ -3173,11 +3173,21 @@ static bool ni_update_parent(struct ntfs_inode *ni, struct NTFS_DUP_INFO *dup, } } -/* TODO: Fill reparse info. */ - dup->reparse =0 ; - dup->ea_size =0 ; + dup->extend_data =0 ; -if (ni->ni_flags &NI_FLAG_EA ) { +if (dup->fa &FILE_ATTRIBUTE_REPARSE_POINT ) { + attr =ni_find_attr (ni,NULL ,NULL ,ATTR_REPARSE ,NULL ,0 ,NULL , +NULL ); + +if (attr) { +const struct REPARSE_POINT *rp; + + rp =resident_data_ex (attr,sizeof (struct REPARSE_POINT )); +/* If ATTR_REPARSE exists 'rp' can't be NULL. */ +if (rp) + dup->extend_data = rp->ReparseTag; + } + }else if (ni->ni_flags &NI_FLAG_EA ) { attr =ni_find_attr (ni, attr, &le,ATTR_EA_INFO ,NULL ,0 ,NULL ,NULL );if (attr) {
@@ -3186,7 +3196,7 @@ static bool ni_update_parent(struct ntfs_inode *ni, struct NTFS_DUP_INFO *dup, info =resident_data_ex (attr,sizeof (struct EA_INFO ));/* If ATTR_EA_INFO exists 'info' can't be NULL. */ if (info) - dup->ea_size = info->size_pack; + dup->extend_data = info->size; } }
fs/ntfs3/inode.c +22 -20
56 lines not on this page · raw message
fs/ntfs3/ntfs.h +1 -2
@@ -561,8 +561,7 @@ struct NTFS_DUP_INFO {__le64 alloc_size;// 0x20: Data attribute allocated size, multiple of cluster size. __le64 data_size;// 0x28: Data attribute size <= Dataalloc_size. enum FILE_ATTRIBUTE fa;// 0x30: Standard DOS attributes & more. -__le16 ea_size;// 0x34: Packed EAs. -__le16 reparse;// 0x36: Used by Reparse. +__le32 extend_data;// 0x34: Extended data. };// 0x38
fs/ntfs3/ntfs_fs.h +1 -1
@@ -884,7 +884,7 @@ int ntfs_acl_chmod(struct mnt_idmap *idmap, struct dentry *dentry);ssize_t ntfs_listxattr (struct dentry *dentry,char *buffer,size_t size);extern const struct xattr_handler *const ntfs_xattr_handlers[]; -int ntfs_save_wsl_perm (struct inode *inode,__le16 *ea_size); +int ntfs_save_wsl_perm (struct inode *inode,__le32 *ea_size);void ntfs_get_wsl_perm (struct inode *inode);/* globals from lznt.c */
fs/ntfs3/xattr.c +3 -3
@@ -313,7 +313,7 @@ static int ntfs_get_ea(struct inode *inode, const char *name, size_t name_len, static noinline int ntfs_set_ea(struct inode *inode, const char *name,size_t name_len,const void *value,size_t val_size,int flags,bool locked, -__le16 *ea_size) +__le32 *ea_size) {struct ntfs_inode *ni =ntfs_i (inode);struct ntfs_sb_info *sbi = ni->mi.sbi;
@@ -522,7 +522,7 @@ static noinline int ntfs_set_ea(struct inode *inode, const char *name,if (ea_info.size_pack != size_pack) ni->ni_flags |=NI_FLAG_UPDATE_PARENT ;if (ea_size) - *ea_size = ea_info.size_pack; + *ea_size = ea_info.size;mark_inode_dirty (&ni->vfs_inode); out:
@@ -950,7 +950,7 @@ static noinline int ntfs_setxattr(const struct xattr_handler *handler,* * save uid/gid/mode in xattr */ -int ntfs_save_wsl_perm (struct inode *inode,__le16 *ea_size) +int ntfs_save_wsl_perm (struct inode *inode,__le32 *ea_size) {int err;__le32 value;
Signature · 1 line
2.49.0