Commit 7f57356b authored by Steve French's avatar Steve French

[CIFS] Remove cifs_sb argument from *build_path_from_dentry

This argument was added in a recent patch, but is unnecessary, since
the superblock is easily obtained from the dentry.
Signed-off-by: default avatarDave Kleikamp <shaggy@austin.ibm.com>
Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
parent a9d02ad4
...@@ -40,7 +40,7 @@ extern unsigned int _GetXid(void); ...@@ -40,7 +40,7 @@ extern unsigned int _GetXid(void);
extern void _FreeXid(unsigned int); extern void _FreeXid(unsigned int);
#define GetXid() (int)_GetXid(); cFYI(1,("CIFS VFS: in %s as Xid: %d with uid: %d",__FUNCTION__, xid,current->fsuid)); #define GetXid() (int)_GetXid(); cFYI(1,("CIFS VFS: in %s as Xid: %d with uid: %d",__FUNCTION__, xid,current->fsuid));
#define FreeXid(curr_xid) {_FreeXid(curr_xid); cFYI(1,("CIFS VFS: leaving %s (xid = %d) rc = %d",__FUNCTION__,curr_xid,(int)rc));} #define FreeXid(curr_xid) {_FreeXid(curr_xid); cFYI(1,("CIFS VFS: leaving %s (xid = %d) rc = %d",__FUNCTION__,curr_xid,(int)rc));}
extern char *build_path_from_dentry(struct dentry *, const struct cifs_sb_info *cifs_sb); extern char *build_path_from_dentry(struct dentry *);
extern char *build_wildcard_path_from_dentry(struct dentry *direntry); extern char *build_wildcard_path_from_dentry(struct dentry *direntry);
extern void renew_parental_timestamps(struct dentry *direntry); extern void renew_parental_timestamps(struct dentry *direntry);
extern int SendReceive(const unsigned int /* xid */ , struct cifsSesInfo *, extern int SendReceive(const unsigned int /* xid */ , struct cifsSesInfo *,
......
...@@ -43,11 +43,12 @@ renew_parental_timestamps(struct dentry *direntry) ...@@ -43,11 +43,12 @@ renew_parental_timestamps(struct dentry *direntry)
/* Note: caller must free return buffer */ /* Note: caller must free return buffer */
char * char *
build_path_from_dentry(struct dentry *direntry, const struct cifs_sb_info *cifs_sb) build_path_from_dentry(struct dentry *direntry)
{ {
struct dentry *temp; struct dentry *temp;
int namelen = 0; int namelen = 0;
char *full_path; char *full_path;
char dirsep = CIFS_DIR_SEP(CIFS_SB(direntry->d_sb));
if(direntry == NULL) if(direntry == NULL)
return NULL; /* not much we can do if dentry is freed and return NULL; /* not much we can do if dentry is freed and
...@@ -74,7 +75,7 @@ build_path_from_dentry(struct dentry *direntry, const struct cifs_sb_info *cifs_ ...@@ -74,7 +75,7 @@ build_path_from_dentry(struct dentry *direntry, const struct cifs_sb_info *cifs_
if (namelen < 0) { if (namelen < 0) {
break; break;
} else { } else {
full_path[namelen] = CIFS_DIR_SEP(cifs_sb); full_path[namelen] = dirsep;
strncpy(full_path + namelen + 1, temp->d_name.name, strncpy(full_path + namelen + 1, temp->d_name.name,
temp->d_name.len); temp->d_name.len);
cFYI(0, (" name: %s ", full_path + namelen)); cFYI(0, (" name: %s ", full_path + namelen));
...@@ -138,7 +139,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, ...@@ -138,7 +139,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
pTcon = cifs_sb->tcon; pTcon = cifs_sb->tcon;
down(&direntry->d_sb->s_vfs_rename_sem); down(&direntry->d_sb->s_vfs_rename_sem);
full_path = build_path_from_dentry(direntry, cifs_sb); full_path = build_path_from_dentry(direntry);
up(&direntry->d_sb->s_vfs_rename_sem); up(&direntry->d_sb->s_vfs_rename_sem);
if(full_path == NULL) { if(full_path == NULL) {
FreeXid(xid); FreeXid(xid);
...@@ -310,7 +311,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode, dev_t dev ...@@ -310,7 +311,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode, dev_t dev
pTcon = cifs_sb->tcon; pTcon = cifs_sb->tcon;
down(&direntry->d_sb->s_vfs_rename_sem); down(&direntry->d_sb->s_vfs_rename_sem);
full_path = build_path_from_dentry(direntry, cifs_sb); full_path = build_path_from_dentry(direntry);
up(&direntry->d_sb->s_vfs_rename_sem); up(&direntry->d_sb->s_vfs_rename_sem);
if(full_path == NULL) if(full_path == NULL)
rc = -ENOMEM; rc = -ENOMEM;
...@@ -409,7 +410,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, struct name ...@@ -409,7 +410,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, struct name
/* can not grab the rename sem here since it would /* can not grab the rename sem here since it would
deadlock in the cases (beginning of sys_rename itself) deadlock in the cases (beginning of sys_rename itself)
in which we already have the sb rename sem */ in which we already have the sb rename sem */
full_path = build_path_from_dentry(direntry, cifs_sb); full_path = build_path_from_dentry(direntry);
if(full_path == NULL) { if(full_path == NULL) {
FreeXid(xid); FreeXid(xid);
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
......
...@@ -83,7 +83,7 @@ int cifs_dir_notify(struct file * file, unsigned long arg) ...@@ -83,7 +83,7 @@ int cifs_dir_notify(struct file * file, unsigned long arg)
pTcon = cifs_sb->tcon; pTcon = cifs_sb->tcon;
down(&file->f_dentry->d_sb->s_vfs_rename_sem); down(&file->f_dentry->d_sb->s_vfs_rename_sem);
full_path = build_path_from_dentry(file->f_dentry, cifs_sb); full_path = build_path_from_dentry(file->f_dentry);
up(&file->f_dentry->d_sb->s_vfs_rename_sem); up(&file->f_dentry->d_sb->s_vfs_rename_sem);
if(full_path == NULL) { if(full_path == NULL) {
......
...@@ -196,7 +196,7 @@ int cifs_open(struct inode *inode, struct file *file) ...@@ -196,7 +196,7 @@ int cifs_open(struct inode *inode, struct file *file)
} }
down(&inode->i_sb->s_vfs_rename_sem); down(&inode->i_sb->s_vfs_rename_sem);
full_path = build_path_from_dentry(file->f_dentry, cifs_sb); full_path = build_path_from_dentry(file->f_dentry);
up(&inode->i_sb->s_vfs_rename_sem); up(&inode->i_sb->s_vfs_rename_sem);
if (full_path == NULL) { if (full_path == NULL) {
FreeXid(xid); FreeXid(xid);
...@@ -366,7 +366,7 @@ static int cifs_reopen_file(struct inode *inode, struct file *file, ...@@ -366,7 +366,7 @@ static int cifs_reopen_file(struct inode *inode, struct file *file,
those that already have the rename sem can end up causing writepage those that already have the rename sem can end up causing writepage
to get called and if the server was down that means we end up here, to get called and if the server was down that means we end up here,
and we can never tell if the caller already has the rename_sem */ and we can never tell if the caller already has the rename_sem */
full_path = build_path_from_dentry(file->f_dentry, cifs_sb); full_path = build_path_from_dentry(file->f_dentry);
if (full_path == NULL) { if (full_path == NULL) {
up(&pCifsFile->fh_sem); up(&pCifsFile->fh_sem);
FreeXid(xid); FreeXid(xid);
......
...@@ -436,7 +436,7 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry) ...@@ -436,7 +436,7 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry)
/* Unlink can be called from rename so we can not grab the sem here /* Unlink can be called from rename so we can not grab the sem here
since we deadlock otherwise */ since we deadlock otherwise */
/* down(&direntry->d_sb->s_vfs_rename_sem);*/ /* down(&direntry->d_sb->s_vfs_rename_sem);*/
full_path = build_path_from_dentry(direntry, cifs_sb); full_path = build_path_from_dentry(direntry);
/* up(&direntry->d_sb->s_vfs_rename_sem);*/ /* up(&direntry->d_sb->s_vfs_rename_sem);*/
if (full_path == NULL) { if (full_path == NULL) {
FreeXid(xid); FreeXid(xid);
...@@ -580,7 +580,7 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode) ...@@ -580,7 +580,7 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
pTcon = cifs_sb->tcon; pTcon = cifs_sb->tcon;
down(&inode->i_sb->s_vfs_rename_sem); down(&inode->i_sb->s_vfs_rename_sem);
full_path = build_path_from_dentry(direntry, cifs_sb); full_path = build_path_from_dentry(direntry);
up(&inode->i_sb->s_vfs_rename_sem); up(&inode->i_sb->s_vfs_rename_sem);
if (full_path == NULL) { if (full_path == NULL) {
FreeXid(xid); FreeXid(xid);
...@@ -654,7 +654,7 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry) ...@@ -654,7 +654,7 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry)
pTcon = cifs_sb->tcon; pTcon = cifs_sb->tcon;
down(&inode->i_sb->s_vfs_rename_sem); down(&inode->i_sb->s_vfs_rename_sem);
full_path = build_path_from_dentry(direntry, cifs_sb); full_path = build_path_from_dentry(direntry);
up(&inode->i_sb->s_vfs_rename_sem); up(&inode->i_sb->s_vfs_rename_sem);
if (full_path == NULL) { if (full_path == NULL) {
FreeXid(xid); FreeXid(xid);
...@@ -707,8 +707,8 @@ int cifs_rename(struct inode *source_inode, struct dentry *source_direntry, ...@@ -707,8 +707,8 @@ int cifs_rename(struct inode *source_inode, struct dentry *source_direntry,
/* we already have the rename sem so we do not need to grab it again /* we already have the rename sem so we do not need to grab it again
here to protect the path integrity */ here to protect the path integrity */
fromName = build_path_from_dentry(source_direntry, cifs_sb_source); fromName = build_path_from_dentry(source_direntry);
toName = build_path_from_dentry(target_direntry, cifs_sb_target); toName = build_path_from_dentry(target_direntry);
if ((fromName == NULL) || (toName == NULL)) { if ((fromName == NULL) || (toName == NULL)) {
rc = -ENOMEM; rc = -ENOMEM;
goto cifs_rename_exit; goto cifs_rename_exit;
...@@ -824,7 +824,7 @@ int cifs_revalidate(struct dentry *direntry) ...@@ -824,7 +824,7 @@ int cifs_revalidate(struct dentry *direntry)
/* can not safely grab the rename sem here if rename calls revalidate /* can not safely grab the rename sem here if rename calls revalidate
since that would deadlock */ since that would deadlock */
full_path = build_path_from_dentry(direntry, cifs_sb); full_path = build_path_from_dentry(direntry);
if (full_path == NULL) { if (full_path == NULL) {
FreeXid(xid); FreeXid(xid);
return -ENOMEM; return -ENOMEM;
...@@ -973,7 +973,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs) ...@@ -973,7 +973,7 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
pTcon = cifs_sb->tcon; pTcon = cifs_sb->tcon;
down(&direntry->d_sb->s_vfs_rename_sem); down(&direntry->d_sb->s_vfs_rename_sem);
full_path = build_path_from_dentry(direntry, cifs_sb); full_path = build_path_from_dentry(direntry);
up(&direntry->d_sb->s_vfs_rename_sem); up(&direntry->d_sb->s_vfs_rename_sem);
if (full_path == NULL) { if (full_path == NULL) {
FreeXid(xid); FreeXid(xid);
......
...@@ -49,8 +49,8 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode, ...@@ -49,8 +49,8 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode,
BB note DFS case in future though (when we may have to check) */ BB note DFS case in future though (when we may have to check) */
down(&inode->i_sb->s_vfs_rename_sem); down(&inode->i_sb->s_vfs_rename_sem);
fromName = build_path_from_dentry(old_file, cifs_sb_target); fromName = build_path_from_dentry(old_file);
toName = build_path_from_dentry(direntry, cifs_sb_target); toName = build_path_from_dentry(direntry);
up(&inode->i_sb->s_vfs_rename_sem); up(&inode->i_sb->s_vfs_rename_sem);
if((fromName == NULL) || (toName == NULL)) { if((fromName == NULL) || (toName == NULL)) {
rc = -ENOMEM; rc = -ENOMEM;
...@@ -105,17 +105,16 @@ cifs_follow_link(struct dentry *direntry, struct nameidata *nd) ...@@ -105,17 +105,16 @@ cifs_follow_link(struct dentry *direntry, struct nameidata *nd)
xid = GetXid(); xid = GetXid();
cifs_sb = CIFS_SB(inode->i_sb);
pTcon = cifs_sb->tcon;
down(&direntry->d_sb->s_vfs_rename_sem); down(&direntry->d_sb->s_vfs_rename_sem);
full_path = build_path_from_dentry(direntry, cifs_sb); full_path = build_path_from_dentry(direntry);
up(&direntry->d_sb->s_vfs_rename_sem); up(&direntry->d_sb->s_vfs_rename_sem);
if (!full_path) if (!full_path)
goto out_no_free; goto out_no_free;
cFYI(1, ("Full path: %s inode = 0x%p", full_path, inode)); cFYI(1, ("Full path: %s inode = 0x%p", full_path, inode));
cifs_sb = CIFS_SB(inode->i_sb);
pTcon = cifs_sb->tcon;
target_path = kmalloc(PATH_MAX, GFP_KERNEL); target_path = kmalloc(PATH_MAX, GFP_KERNEL);
if (!target_path) { if (!target_path) {
target_path = ERR_PTR(-ENOMEM); target_path = ERR_PTR(-ENOMEM);
...@@ -168,7 +167,7 @@ cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname) ...@@ -168,7 +167,7 @@ cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname)
pTcon = cifs_sb->tcon; pTcon = cifs_sb->tcon;
down(&inode->i_sb->s_vfs_rename_sem); down(&inode->i_sb->s_vfs_rename_sem);
full_path = build_path_from_dentry(direntry, cifs_sb); full_path = build_path_from_dentry(direntry);
up(&inode->i_sb->s_vfs_rename_sem); up(&inode->i_sb->s_vfs_rename_sem);
if(full_path == NULL) { if(full_path == NULL) {
...@@ -237,7 +236,7 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen) ...@@ -237,7 +236,7 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)
/* BB would it be safe against deadlock to grab this sem /* BB would it be safe against deadlock to grab this sem
even though rename itself grabs the sem and calls lookup? */ even though rename itself grabs the sem and calls lookup? */
/* down(&inode->i_sb->s_vfs_rename_sem);*/ /* down(&inode->i_sb->s_vfs_rename_sem);*/
full_path = build_path_from_dentry(direntry, cifs_sb); full_path = build_path_from_dentry(direntry);
/* up(&inode->i_sb->s_vfs_rename_sem);*/ /* up(&inode->i_sb->s_vfs_rename_sem);*/
if(full_path == NULL) { if(full_path == NULL) {
......
...@@ -368,7 +368,7 @@ static int initiate_cifs_search(const int xid, struct file *file) ...@@ -368,7 +368,7 @@ static int initiate_cifs_search(const int xid, struct file *file)
return -EINVAL; return -EINVAL;
down(&file->f_dentry->d_sb->s_vfs_rename_sem); down(&file->f_dentry->d_sb->s_vfs_rename_sem);
full_path = build_path_from_dentry(file->f_dentry, cifs_sb); full_path = build_path_from_dentry(file->f_dentry);
up(&file->f_dentry->d_sb->s_vfs_rename_sem); up(&file->f_dentry->d_sb->s_vfs_rename_sem);
if(full_path == NULL) { if(full_path == NULL) {
......
...@@ -63,7 +63,7 @@ int cifs_removexattr(struct dentry * direntry, const char * ea_name) ...@@ -63,7 +63,7 @@ int cifs_removexattr(struct dentry * direntry, const char * ea_name)
pTcon = cifs_sb->tcon; pTcon = cifs_sb->tcon;
down(&sb->s_vfs_rename_sem); down(&sb->s_vfs_rename_sem);
full_path = build_path_from_dentry(direntry, cifs_sb); full_path = build_path_from_dentry(direntry);
up(&sb->s_vfs_rename_sem); up(&sb->s_vfs_rename_sem);
if(full_path == NULL) { if(full_path == NULL) {
FreeXid(xid); FreeXid(xid);
...@@ -118,7 +118,7 @@ int cifs_setxattr(struct dentry * direntry, const char * ea_name, ...@@ -118,7 +118,7 @@ int cifs_setxattr(struct dentry * direntry, const char * ea_name,
pTcon = cifs_sb->tcon; pTcon = cifs_sb->tcon;
down(&sb->s_vfs_rename_sem); down(&sb->s_vfs_rename_sem);
full_path = build_path_from_dentry(direntry, cifs_sb); full_path = build_path_from_dentry(direntry);
up(&sb->s_vfs_rename_sem); up(&sb->s_vfs_rename_sem);
if(full_path == NULL) { if(full_path == NULL) {
FreeXid(xid); FreeXid(xid);
...@@ -227,7 +227,7 @@ ssize_t cifs_getxattr(struct dentry * direntry, const char * ea_name, ...@@ -227,7 +227,7 @@ ssize_t cifs_getxattr(struct dentry * direntry, const char * ea_name,
pTcon = cifs_sb->tcon; pTcon = cifs_sb->tcon;
down(&sb->s_vfs_rename_sem); down(&sb->s_vfs_rename_sem);
full_path = build_path_from_dentry(direntry, cifs_sb); full_path = build_path_from_dentry(direntry);
up(&sb->s_vfs_rename_sem); up(&sb->s_vfs_rename_sem);
if(full_path == NULL) { if(full_path == NULL) {
FreeXid(xid); FreeXid(xid);
...@@ -328,7 +328,7 @@ ssize_t cifs_listxattr(struct dentry * direntry, char * data, size_t buf_size) ...@@ -328,7 +328,7 @@ ssize_t cifs_listxattr(struct dentry * direntry, char * data, size_t buf_size)
pTcon = cifs_sb->tcon; pTcon = cifs_sb->tcon;
down(&sb->s_vfs_rename_sem); down(&sb->s_vfs_rename_sem);
full_path = build_path_from_dentry(direntry, cifs_sb); full_path = build_path_from_dentry(direntry);
up(&sb->s_vfs_rename_sem); up(&sb->s_vfs_rename_sem);
if(full_path == NULL) { if(full_path == NULL) {
FreeXid(xid); FreeXid(xid);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment