@@ -558,6 +558,7 @@ struct dfs_info3_param {
#define CIFS_FATTR_DELETE_PENDING 0x2
#define CIFS_FATTR_NEED_REVAL 0x4
#define CIFS_FATTR_INO_COLLISION 0x8
+#define CIFS_FATTR_NLINK_NOT_SET 0x10 /* number of hardlinks unknown */
struct cifs_fattr {
u32 cf_flags;
@@ -1326,7 +1326,7 @@ openRetry:
/* the file_info buf is endian converted by caller */
pfile_info->AllocationSize = pSMBr->AllocationSize;
pfile_info->EndOfFile = pSMBr->EndOfFile;
- pfile_info->NumberOfLinks = cpu_to_le32(1);
+ pfile_info->NumberOfLinks = 0; /* not known */
pfile_info->DeletePending = 0;
}
}
@@ -128,7 +128,8 @@ cifs_fattr_to_inode(struct inode *inode, struct cifs_fattr *fattr)
inode->i_mtime = fattr->cf_mtime;
inode->i_ctime = fattr->cf_ctime;
inode->i_rdev = fattr->cf_rdev;
- inode->i_nlink = fattr->cf_nlink;
+ if (!(fattr->cf_flags & CIFS_FATTR_NLINK_NOT_SET))
+ inode->i_nlink = fattr->cf_nlink;
inode->i_uid = fattr->cf_uid;
inode->i_gid = fattr->cf_gid;
@@ -531,7 +532,10 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info,
fattr->cf_mode &= ~(S_IWUGO);
}
- fattr->cf_nlink = le32_to_cpu(info->NumberOfLinks);
+ if (info->NumberOfLinks)
+ fattr->cf_nlink = le32_to_cpu(info->NumberOfLinks);
+ else
+ fattr->cf_flags |= CIFS_FATTR_NLINK_NOT_SET;
fattr->cf_uid = cifs_sb->mnt_uid;
fattr->cf_gid = cifs_sb->mnt_gid;