Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 23049
b: refs/heads/master
c: a11f3a0
h: refs/heads/master
i:
  23047: fb03cb0
v: v3
  • Loading branch information
Arjan van de Ven authored and Linus Torvalds committed Mar 23, 2006
1 parent 8c8e987 commit 1fbaa88
Show file tree
Hide file tree
Showing 11 changed files with 43 additions and 43 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 144efe3e3e5ad57af549bf800fa4560d7c74e9fe
refs/heads/master: a11f3a0574a5734db3e5de38922430d005d35118
8 changes: 4 additions & 4 deletions trunk/fs/cifs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
cifs_sb = CIFS_SB(inode->i_sb);
pTcon = cifs_sb->tcon;

down(&direntry->d_sb->s_vfs_rename_sem);
mutex_lock(&direntry->d_sb->s_vfs_rename_mutex);
full_path = build_path_from_dentry(direntry);
up(&direntry->d_sb->s_vfs_rename_sem);
mutex_unlock(&direntry->d_sb->s_vfs_rename_mutex);
if(full_path == NULL) {
FreeXid(xid);
return -ENOMEM;
Expand Down Expand Up @@ -317,9 +317,9 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode,
cifs_sb = CIFS_SB(inode->i_sb);
pTcon = cifs_sb->tcon;

down(&direntry->d_sb->s_vfs_rename_sem);
mutex_lock(&direntry->d_sb->s_vfs_rename_mutex);
full_path = build_path_from_dentry(direntry);
up(&direntry->d_sb->s_vfs_rename_sem);
mutex_unlock(&direntry->d_sb->s_vfs_rename_mutex);
if(full_path == NULL)
rc = -ENOMEM;
else if (pTcon->ses->capabilities & CAP_UNIX) {
Expand Down
4 changes: 2 additions & 2 deletions trunk/fs/cifs/fcntl.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ int cifs_dir_notify(struct file * file, unsigned long arg)
cifs_sb = CIFS_SB(file->f_dentry->d_sb);
pTcon = cifs_sb->tcon;

down(&file->f_dentry->d_sb->s_vfs_rename_sem);
mutex_lock(&file->f_dentry->d_sb->s_vfs_rename_mutex);
full_path = build_path_from_dentry(file->f_dentry);
up(&file->f_dentry->d_sb->s_vfs_rename_sem);
mutex_unlock(&file->f_dentry->d_sb->s_vfs_rename_mutex);

if(full_path == NULL) {
rc = -ENOMEM;
Expand Down
4 changes: 2 additions & 2 deletions trunk/fs/cifs/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,9 +203,9 @@ int cifs_open(struct inode *inode, struct file *file)
}
}

down(&inode->i_sb->s_vfs_rename_sem);
mutex_lock(&inode->i_sb->s_vfs_rename_mutex);
full_path = build_path_from_dentry(file->f_dentry);
up(&inode->i_sb->s_vfs_rename_sem);
mutex_unlock(&inode->i_sb->s_vfs_rename_mutex);
if (full_path == NULL) {
FreeXid(xid);
return -ENOMEM;
Expand Down
16 changes: 8 additions & 8 deletions trunk/fs/cifs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,9 +574,9 @@ int cifs_unlink(struct inode *inode, struct dentry *direntry)

/* 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);*/
/* mutex_lock(&direntry->d_sb->s_vfs_rename_mutex);*/
full_path = build_path_from_dentry(direntry);
/* up(&direntry->d_sb->s_vfs_rename_sem);*/
/* mutex_unlock(&direntry->d_sb->s_vfs_rename_mutex);*/
if (full_path == NULL) {
FreeXid(xid);
return -ENOMEM;
Expand Down Expand Up @@ -718,9 +718,9 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
cifs_sb = CIFS_SB(inode->i_sb);
pTcon = cifs_sb->tcon;

down(&inode->i_sb->s_vfs_rename_sem);
mutex_lock(&inode->i_sb->s_vfs_rename_mutex);
full_path = build_path_from_dentry(direntry);
up(&inode->i_sb->s_vfs_rename_sem);
mutex_unlock(&inode->i_sb->s_vfs_rename_mutex);
if (full_path == NULL) {
FreeXid(xid);
return -ENOMEM;
Expand Down Expand Up @@ -803,9 +803,9 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry)
cifs_sb = CIFS_SB(inode->i_sb);
pTcon = cifs_sb->tcon;

down(&inode->i_sb->s_vfs_rename_sem);
mutex_lock(&inode->i_sb->s_vfs_rename_mutex);
full_path = build_path_from_dentry(direntry);
up(&inode->i_sb->s_vfs_rename_sem);
mutex_unlock(&inode->i_sb->s_vfs_rename_mutex);
if (full_path == NULL) {
FreeXid(xid);
return -ENOMEM;
Expand Down Expand Up @@ -1137,9 +1137,9 @@ int cifs_setattr(struct dentry *direntry, struct iattr *attrs)
rc = 0;
}

down(&direntry->d_sb->s_vfs_rename_sem);
mutex_lock(&direntry->d_sb->s_vfs_rename_mutex);
full_path = build_path_from_dentry(direntry);
up(&direntry->d_sb->s_vfs_rename_sem);
mutex_unlock(&direntry->d_sb->s_vfs_rename_mutex);
if (full_path == NULL) {
FreeXid(xid);
return -ENOMEM;
Expand Down
16 changes: 8 additions & 8 deletions trunk/fs/cifs/link.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ cifs_hardlink(struct dentry *old_file, struct inode *inode,
/* No need to check for cross device links since server will do that
BB note DFS case in future though (when we may have to check) */

down(&inode->i_sb->s_vfs_rename_sem);
mutex_lock(&inode->i_sb->s_vfs_rename_mutex);
fromName = build_path_from_dentry(old_file);
toName = build_path_from_dentry(direntry);
up(&inode->i_sb->s_vfs_rename_sem);
mutex_unlock(&inode->i_sb->s_vfs_rename_mutex);
if((fromName == NULL) || (toName == NULL)) {
rc = -ENOMEM;
goto cifs_hl_exit;
Expand Down Expand Up @@ -103,9 +103,9 @@ cifs_follow_link(struct dentry *direntry, struct nameidata *nd)

xid = GetXid();

down(&direntry->d_sb->s_vfs_rename_sem);
mutex_lock(&direntry->d_sb->s_vfs_rename_mutex);
full_path = build_path_from_dentry(direntry);
up(&direntry->d_sb->s_vfs_rename_sem);
mutex_unlock(&direntry->d_sb->s_vfs_rename_mutex);

if (!full_path)
goto out_no_free;
Expand Down Expand Up @@ -164,9 +164,9 @@ cifs_symlink(struct inode *inode, struct dentry *direntry, const char *symname)
cifs_sb = CIFS_SB(inode->i_sb);
pTcon = cifs_sb->tcon;

down(&inode->i_sb->s_vfs_rename_sem);
mutex_lock(&inode->i_sb->s_vfs_rename_mutex);
full_path = build_path_from_dentry(direntry);
up(&inode->i_sb->s_vfs_rename_sem);
mutex_unlock(&inode->i_sb->s_vfs_rename_mutex);

if(full_path == NULL) {
FreeXid(xid);
Expand Down Expand Up @@ -232,9 +232,9 @@ cifs_readlink(struct dentry *direntry, char __user *pBuffer, int buflen)

/* 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);*/
/* mutex_lock(&inode->i_sb->s_vfs_rename_mutex);*/
full_path = build_path_from_dentry(direntry);
/* up(&inode->i_sb->s_vfs_rename_sem);*/
/* mutex_unlock(&inode->i_sb->s_vfs_rename_mutex);*/

if(full_path == NULL) {
FreeXid(xid);
Expand Down
4 changes: 2 additions & 2 deletions trunk/fs/cifs/readdir.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,9 @@ static int initiate_cifs_search(const int xid, struct file *file)
if(pTcon == NULL)
return -EINVAL;

down(&file->f_dentry->d_sb->s_vfs_rename_sem);
mutex_lock(&file->f_dentry->d_sb->s_vfs_rename_mutex);
full_path = build_path_from_dentry(file->f_dentry);
up(&file->f_dentry->d_sb->s_vfs_rename_sem);
mutex_unlock(&file->f_dentry->d_sb->s_vfs_rename_mutex);

if(full_path == NULL) {
return -ENOMEM;
Expand Down
16 changes: 8 additions & 8 deletions trunk/fs/cifs/xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ int cifs_removexattr(struct dentry * direntry, const char * ea_name)
cifs_sb = CIFS_SB(sb);
pTcon = cifs_sb->tcon;

down(&sb->s_vfs_rename_sem);
mutex_lock(&sb->s_vfs_rename_mutex);
full_path = build_path_from_dentry(direntry);
up(&sb->s_vfs_rename_sem);
mutex_unlock(&sb->s_vfs_rename_mutex);
if(full_path == NULL) {
FreeXid(xid);
return -ENOMEM;
Expand Down Expand Up @@ -116,9 +116,9 @@ int cifs_setxattr(struct dentry * direntry, const char * ea_name,
cifs_sb = CIFS_SB(sb);
pTcon = cifs_sb->tcon;

down(&sb->s_vfs_rename_sem);
mutex_lock(&sb->s_vfs_rename_mutex);
full_path = build_path_from_dentry(direntry);
up(&sb->s_vfs_rename_sem);
mutex_unlock(&sb->s_vfs_rename_mutex);
if(full_path == NULL) {
FreeXid(xid);
return -ENOMEM;
Expand Down Expand Up @@ -223,9 +223,9 @@ ssize_t cifs_getxattr(struct dentry * direntry, const char * ea_name,
cifs_sb = CIFS_SB(sb);
pTcon = cifs_sb->tcon;

down(&sb->s_vfs_rename_sem);
mutex_lock(&sb->s_vfs_rename_mutex);
full_path = build_path_from_dentry(direntry);
up(&sb->s_vfs_rename_sem);
mutex_unlock(&sb->s_vfs_rename_mutex);
if(full_path == NULL) {
FreeXid(xid);
return -ENOMEM;
Expand Down Expand Up @@ -341,9 +341,9 @@ ssize_t cifs_listxattr(struct dentry * direntry, char * data, size_t buf_size)
cifs_sb = CIFS_SB(sb);
pTcon = cifs_sb->tcon;

down(&sb->s_vfs_rename_sem);
mutex_lock(&sb->s_vfs_rename_mutex);
full_path = build_path_from_dentry(direntry);
up(&sb->s_vfs_rename_sem);
mutex_unlock(&sb->s_vfs_rename_mutex);
if(full_path == NULL) {
FreeXid(xid);
return -ENOMEM;
Expand Down
12 changes: 6 additions & 6 deletions trunk/fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
*/
/*
* [Sep 2001 AV] Single-semaphore locking scheme (kudos to David Holland)
* implemented. Let's see if raised priority of ->s_vfs_rename_sem gives
* implemented. Let's see if raised priority of ->s_vfs_rename_mutex gives
* any extra contention...
*/

Expand Down Expand Up @@ -1422,7 +1422,7 @@ struct dentry *lock_rename(struct dentry *p1, struct dentry *p2)
return NULL;
}

down(&p1->d_inode->i_sb->s_vfs_rename_sem);
mutex_lock(&p1->d_inode->i_sb->s_vfs_rename_mutex);

for (p = p1; p->d_parent != p; p = p->d_parent) {
if (p->d_parent == p2) {
Expand Down Expand Up @@ -1450,7 +1450,7 @@ void unlock_rename(struct dentry *p1, struct dentry *p2)
mutex_unlock(&p1->d_inode->i_mutex);
if (p1 != p2) {
mutex_unlock(&p2->d_inode->i_mutex);
up(&p1->d_inode->i_sb->s_vfs_rename_sem);
mutex_unlock(&p1->d_inode->i_sb->s_vfs_rename_mutex);
}
}

Expand Down Expand Up @@ -2277,17 +2277,17 @@ asmlinkage long sys_link(const char __user *oldname, const char __user *newname)
* a) we can get into loop creation. Check is done in is_subdir().
* b) race potential - two innocent renames can create a loop together.
* That's where 4.4 screws up. Current fix: serialization on
* sb->s_vfs_rename_sem. We might be more accurate, but that's another
* sb->s_vfs_rename_mutex. We might be more accurate, but that's another
* story.
* c) we have to lock _three_ objects - parents and victim (if it exists).
* And that - after we got ->i_mutex on parents (until then we don't know
* whether the target exists). Solution: try to be smart with locking
* order for inodes. We rely on the fact that tree topology may change
* only under ->s_vfs_rename_sem _and_ that parent of the object we
* only under ->s_vfs_rename_mutex _and_ that parent of the object we
* move will be locked. Thus we can rank directories by the tree
* (ancestors first) and rank all non-directories after them.
* That works since everybody except rename does "lock parent, lookup,
* lock child" and rename is under ->s_vfs_rename_sem.
* lock child" and rename is under ->s_vfs_rename_mutex.
* HOWEVER, it relies on the assumption that any object with ->lookup()
* has no more than 1 dentry. If "hybrid" objects will ever appear,
* we'd better make sure that there's no link(2) for them.
Expand Down
2 changes: 1 addition & 1 deletion trunk/fs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ static struct super_block *alloc_super(void)
down_write(&s->s_umount);
s->s_count = S_BIAS;
atomic_set(&s->s_active, 1);
sema_init(&s->s_vfs_rename_sem,1);
mutex_init(&s->s_vfs_rename_mutex);
mutex_init(&s->s_dquot.dqio_mutex);
mutex_init(&s->s_dquot.dqonoff_mutex);
init_rwsem(&s->s_dquot.dqptr_sem);
Expand Down
2 changes: 1 addition & 1 deletion trunk/include/linux/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ struct super_block {
* The next field is for VFS *only*. No filesystems have any business
* even looking at it. You had been warned.
*/
struct semaphore s_vfs_rename_sem; /* Kludge */
struct mutex s_vfs_rename_mutex; /* Kludge */

/* Granuality of c/m/atime in ns.
Cannot be worse than a second */
Expand Down

0 comments on commit 1fbaa88

Please sign in to comment.