int
cifs_get_inode_info_unix(struct inode **pinode,
const unsigned char *search_path,
- struct super_block *sb)
+ struct super_block *sb,int xid)
{
- int xid;
int rc = 0;
FILE_UNIX_BASIC_INFO findData;
struct cifsTconInfo *pTcon;
struct cifs_sb_info *cifs_sb = CIFS_SB(sb);
char *tmp_path;
- xid = GetXid();
-
pTcon = cifs_sb->tcon;
cFYI(1, (" Getting info on %s ", search_path));
/* we could have done a find first instead but this returns more info */
strnlen(search_path, MAX_PATHCONF) + 1,
GFP_KERNEL);
if (tmp_path == NULL) {
- FreeXid(xid);
return -ENOMEM;
}
/* have to skip first of the double backslash of UNC name */
/* BB fix up inode etc. */
} else if (rc) {
- FreeXid(xid);
return rc;
}
/* get new inode */
if (*pinode == NULL) {
*pinode = new_inode(sb);
+ if(*pinode == NULL)
+ return -ENOMEM;
+ insert_inode_hash(*pinode);
}
+
inode = *pinode;
-
cifsInfo = CIFS_I(inode);
cFYI(1, (" Old time %ld ", cifsInfo->time));
inode->i_mode |= S_IFDIR;
} else if (findData.Type == UNIX_CHARDEV) {
inode->i_mode |= S_IFCHR;
+ inode->i_rdev = MKDEV(le64_to_cpu(findData.DevMajor),
+ le64_to_cpu(findData.DevMinor) & MINORMASK);
} else if (findData.Type == UNIX_BLOCKDEV) {
inode->i_mode |= S_IFBLK;
+ inode->i_rdev = MKDEV(le64_to_cpu(findData.DevMajor),
+ le64_to_cpu(findData.DevMinor) & MINORMASK);
} else if (findData.Type == UNIX_FIFO) {
inode->i_mode |= S_IFIFO;
} else if (findData.Type == UNIX_SOCKET) {
inode->i_rdev);
}
}
- FreeXid(xid);
return rc;
}
int
cifs_get_inode_info(struct inode **pinode, const unsigned char *search_path,
- FILE_ALL_INFO * pfindData, struct super_block *sb)
+ FILE_ALL_INFO * pfindData, struct super_block *sb, int xid)
{
- int xid;
int rc = 0;
struct cifsTconInfo *pTcon;
struct inode *inode;
char *tmp_path;
char *buf = NULL;
- xid = GetXid();
-
pTcon = cifs_sb->tcon;
cFYI(1,("Getting info on %s ", search_path));
if((pfindData == NULL) && (*pinode != NULL)) {
if(CIFS_I(*pinode)->clientCanCacheRead) {
cFYI(1,("No need to revalidate inode sizes on cached file "));
- FreeXid(xid);
return rc;
}
}
if (tmp_path == NULL) {
if(buf)
kfree(buf);
- FreeXid(xid);
return -ENOMEM;
}
} else if (rc) {
if(buf)
kfree(buf);
- FreeXid(xid);
return rc;
}
} else {
/* get new inode */
if (*pinode == NULL) {
*pinode = new_inode(sb);
+ if(*pinode == NULL)
+ return -ENOMEM;
+ insert_inode_hash(*pinode);
}
-
inode = *pinode;
cifsInfo = CIFS_I(inode);
pfindData->Attributes = le32_to_cpu(pfindData->Attributes);
}
if(buf)
kfree(buf);
- FreeXid(xid);
return rc;
}
void
cifs_read_inode(struct inode *inode)
{ /* gets root inode */
-
+ int xid;
struct cifs_sb_info *cifs_sb;
cifs_sb = CIFS_SB(inode->i_sb);
-
+ xid = GetXid();
if (cifs_sb->tcon->ses->capabilities & CAP_UNIX)
- cifs_get_inode_info_unix(&inode, "", inode->i_sb);
+ cifs_get_inode_info_unix(&inode, "", inode->i_sb,xid);
else
- cifs_get_inode_info(&inode, "", NULL, inode->i_sb);
+ cifs_get_inode_info(&inode, "", NULL, inode->i_sb,xid);
+ /* can not call macro FreeXid here since in a void func */
+ _FreeXid(xid);
}
int
inode->i_nlink++;
if (pTcon->ses->capabilities & CAP_UNIX)
rc = cifs_get_inode_info_unix(&newinode, full_path,
- inode->i_sb);
+ inode->i_sb,xid);
else
rc = cifs_get_inode_info(&newinode, full_path,NULL,
- inode->i_sb);
+ inode->i_sb,xid);
direntry->d_op = &cifs_dentry_ops;
d_instantiate(direntry, newinode);
if(direntry->d_inode)
direntry->d_inode->i_nlink = 2;
- if (cifs_sb->tcon->ses->capabilities & CAP_UNIX)
- CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode,
- (__u64)-1,
- (__u64)-1,
- 0 /* dev_t */,
- cifs_sb->local_nls);
+ if (cifs_sb->tcon->ses->capabilities & CAP_UNIX)
+ if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
+ CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode,
+ (__u64)current->euid,
+ (__u64)current->egid,
+ 0 /* dev_t */,
+ cifs_sb->local_nls);
+ } else {
+ CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode,
+ (__u64)-1,
+ (__u64)-1,
+ 0 /* dev_t */,
+ cifs_sb->local_nls);
+ }
else { /* BB to be implemented via Windows secrty descriptors*/
/* eg CIFSSMBWinSetPerms(xid,pTcon,full_path,mode,-1,-1,local_nls);*/
}
if (cifs_sb->tcon->ses->capabilities & CAP_UNIX) {
rc = cifs_get_inode_info_unix(&direntry->d_inode, full_path,
- direntry->d_sb);
+ direntry->d_sb,xid);
if(rc) {
cFYI(1,("error on getting revalidate info %d",rc));
/* if(rc != -ENOENT)
}
} else {
rc = cifs_get_inode_info(&direntry->d_inode, full_path, NULL,
- direntry->d_sb);
+ direntry->d_sb,xid);
if(rc) {
cFYI(1,("error on getting revalidate info %d",rc));
/* if(rc != -ENOENT)
}
/* do not need local check to inode_check_ok since the server does that */
- inode_setattr(direntry->d_inode, attrs);
+ if (!rc)
+ rc = inode_setattr(direntry->d_inode, attrs);
if (full_path)
kfree(full_path);
FreeXid(xid);