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 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 void renew_parental_timestamps(struct dentry *direntry);
extern int SendReceive(const unsigned int /* xid */ , struct cifsSesInfo *,
/* Note: caller must free return buffer */
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;
int namelen = 0;
char *full_path;
+ char dirsep = CIFS_DIR_SEP(CIFS_SB(direntry->d_sb));
if(direntry == NULL)
return NULL; /* not much we can do if dentry is freed and
if (namelen < 0) {
break;
} else {
- full_path[namelen] = CIFS_DIR_SEP(cifs_sb);
+ full_path[namelen] = dirsep;
strncpy(full_path + namelen + 1, temp->d_name.name,
temp->d_name.len);
cFYI(0, (" name: %s ", full_path + namelen));
pTcon = cifs_sb->tcon;
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);
if(full_path == NULL) {
FreeXid(xid);
pTcon = cifs_sb->tcon;
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);
if(full_path == NULL)
rc = -ENOMEM;
/* can not grab the rename sem here since it would
deadlock in the cases (beginning of sys_rename itself)
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) {
FreeXid(xid);
return ERR_PTR(-ENOMEM);
pTcon = cifs_sb->tcon;
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);
if(full_path == NULL) {
}
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);
if (full_path == NULL) {
FreeXid(xid);
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,
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) {
up(&pCifsFile->fh_sem);
FreeXid(xid);
/* Unlink can be called from rename so we can not grab the sem here
since we deadlock otherwise */
/* 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);*/
if (full_path == NULL) {
FreeXid(xid);
pTcon = cifs_sb->tcon;
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);
if (full_path == NULL) {
FreeXid(xid);
pTcon = cifs_sb->tcon;
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);
if (full_path == NULL) {
FreeXid(xid);
/* we already have the rename sem so we do not need to grab it again
here to protect the path integrity */
- fromName = build_path_from_dentry(source_direntry, cifs_sb_source);
- toName = build_path_from_dentry(target_direntry, cifs_sb_target);
+ fromName = build_path_from_dentry(source_direntry);
+ toName = build_path_from_dentry(target_direntry);
if ((fromName == NULL) || (toName == NULL)) {
rc = -ENOMEM;
goto cifs_rename_exit;
/* can not safely grab the rename sem here if rename calls revalidate
since that would deadlock */
- full_path = build_path_from_dentry(direntry, cifs_sb);
+ full_path = build_path_from_dentry(direntry);
if (full_path == NULL) {
FreeXid(xid);
return -ENOMEM;
pTcon = cifs_sb->tcon;
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);
if (full_path == NULL) {
FreeXid(xid);
BB note DFS case in future though (when we may have to check) */
down(&inode->i_sb->s_vfs_rename_sem);
- fromName = build_path_from_dentry(old_file, cifs_sb_target);
- toName = build_path_from_dentry(direntry, cifs_sb_target);
+ fromName = build_path_from_dentry(old_file);
+ toName = build_path_from_dentry(direntry);
up(&inode->i_sb->s_vfs_rename_sem);
if((fromName == NULL) || (toName == NULL)) {
rc = -ENOMEM;
xid = GetXid();
- cifs_sb = CIFS_SB(inode->i_sb);
- pTcon = cifs_sb->tcon;
-
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);
if (!full_path)
goto out_no_free;
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);
if (!target_path) {
target_path = ERR_PTR(-ENOMEM);
pTcon = cifs_sb->tcon;
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);
if(full_path == NULL) {
/* BB would it be safe against deadlock to grab this sem
even though rename itself grabs the sem and calls lookup? */
/* 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);*/
if(full_path == NULL) {
return -EINVAL;
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);
if(full_path == NULL) {
pTcon = cifs_sb->tcon;
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);
if(full_path == NULL) {
FreeXid(xid);
pTcon = cifs_sb->tcon;
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);
if(full_path == NULL) {
FreeXid(xid);
pTcon = cifs_sb->tcon;
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);
if(full_path == NULL) {
FreeXid(xid);
pTcon = cifs_sb->tcon;
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);
if(full_path == NULL) {
FreeXid(xid);