summaryrefslogtreecommitdiff
path: root/fs/cifs/readdir.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs/readdir.c')
-rw-r--r--fs/cifs/readdir.c43
1 files changed, 34 insertions, 9 deletions
diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index a86bd1c07602..9bdaaecae36f 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -142,6 +142,11 @@ static void fill_in_inode(struct inode *tmp_inode,
tmp_inode->i_gid = cifs_sb->mnt_gid;
/* set default mode. will override for dirs below */
tmp_inode->i_mode = cifs_sb->mnt_file_mode;
+ } else {
+ /* mask off the type bits since it gets set
+ below and we do not want to get two type
+ bits set */
+ tmp_inode->i_mode &= ~S_IFMT;
}
if (attr & ATTR_DIRECTORY) {
@@ -152,12 +157,18 @@ static void fill_in_inode(struct inode *tmp_inode,
}
tmp_inode->i_mode |= S_IFDIR;
} else if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) &&
- (attr & ATTR_SYSTEM) && (end_of_file == 0)) {
- *pobject_type = DT_FIFO;
- tmp_inode->i_mode |= S_IFIFO;
-/* BB Finish for SFU style symlinks and devies */
-/* } else if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_UNX_EMUL) &&
- (attr & ATTR_SYSTEM) && ) { */
+ (attr & ATTR_SYSTEM)) {
+ if (end_of_file == 0) {
+ *pobject_type = DT_FIFO;
+ tmp_inode->i_mode |= S_IFIFO;
+ } else {
+ /* rather than get the type here, we mark the
+ inode as needing revalidate and get the real type
+ (blk vs chr vs. symlink) later ie in lookup */
+ *pobject_type = DT_REG;
+ tmp_inode->i_mode |= S_IFREG;
+ cifsInfo->time = 0;
+ }
/* we no longer mark these because we could not follow them */
/* } else if (attr & ATTR_REPARSE) {
*pobject_type = DT_LNK;
@@ -193,8 +204,14 @@ static void fill_in_inode(struct inode *tmp_inode,
if (S_ISREG(tmp_inode->i_mode)) {
cFYI(1, ("File inode"));
tmp_inode->i_op = &cifs_file_inode_ops;
- if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO)
- tmp_inode->i_fop = &cifs_file_direct_ops;
+ if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) {
+ if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
+ tmp_inode->i_fop = &cifs_file_direct_nobrl_ops;
+ else
+ tmp_inode->i_fop = &cifs_file_direct_ops;
+
+ } else if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
+ tmp_inode->i_fop = &cifs_file_nobrl_ops;
else
tmp_inode->i_fop = &cifs_file_ops;
if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
@@ -258,6 +275,9 @@ static void unix_fill_in_inode(struct inode *tmp_inode,
cifs_NTtimeToUnix(le64_to_cpu(pfindData->LastStatusChange));
tmp_inode->i_mode = le64_to_cpu(pfindData->Permissions);
+ /* since we set the inode type below we need to mask off type
+ to avoid strange results if bits above were corrupt */
+ tmp_inode->i_mode &= ~S_IFMT;
if (type == UNIX_FILE) {
*pobject_type = DT_REG;
tmp_inode->i_mode |= S_IFREG;
@@ -283,6 +303,11 @@ static void unix_fill_in_inode(struct inode *tmp_inode,
} else if (type == UNIX_SOCKET) {
*pobject_type = DT_SOCK;
tmp_inode->i_mode |= S_IFSOCK;
+ } else {
+ /* safest to just call it a file */
+ *pobject_type = DT_REG;
+ tmp_inode->i_mode |= S_IFREG;
+ cFYI(1,("unknown inode type %d",type));
}
tmp_inode->i_uid = le64_to_cpu(pfindData->Uid);
@@ -699,7 +724,7 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst,
(__le16 *)filename, len/2, nlt);
else
pqst->len = cifs_strfromUCS_le((char *)pqst->name,
- (wchar_t *)filename,len/2,nlt);
+ (__le16 *)filename,len/2,nlt);
} else {
pqst->name = filename;
pqst->len = len;