Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 25994
b: refs/heads/master
c: ca99c1d
h: refs/heads/master
v: v3
  • Loading branch information
Dipankar Sarma authored and Linus Torvalds committed Apr 19, 2006
1 parent b5e090e commit 2f0b7a8
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 11 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: fb30d64568fd8f6a21afef987f11852a109723da
refs/heads/master: ca99c1da080345e227cfb083c330a184d42e27f3
8 changes: 6 additions & 2 deletions trunk/drivers/char/tty_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -2723,7 +2723,11 @@ static void __do_SAK(void *arg)
}
task_lock(p);
if (p->files) {
rcu_read_lock();
/*
* We don't take a ref to the file, so we must
* hold ->file_lock instead.
*/
spin_lock(&p->files->file_lock);
fdt = files_fdtable(p->files);
for (i=0; i < fdt->max_fds; i++) {
filp = fcheck_files(p->files, i);
Expand All @@ -2738,7 +2742,7 @@ static void __do_SAK(void *arg)
break;
}
}
rcu_read_unlock();
spin_unlock(&p->files->file_lock);
}
task_unlock(p);
} while_each_thread(g, p);
Expand Down
9 changes: 7 additions & 2 deletions trunk/fs/locks.c
Original file line number Diff line number Diff line change
Expand Up @@ -2230,7 +2230,12 @@ void steal_locks(fl_owner_t from)

lock_kernel();
j = 0;
rcu_read_lock();

/*
* We are not taking a ref to the file structures, so
* we need to acquire ->file_lock.
*/
spin_lock(&files->file_lock);
fdt = files_fdtable(files);
for (;;) {
unsigned long set;
Expand All @@ -2248,7 +2253,7 @@ void steal_locks(fl_owner_t from)
set >>= 1;
}
}
rcu_read_unlock();
spin_unlock(&files->file_lock);
unlock_kernel();
}
EXPORT_SYMBOL(steal_locks);
Expand Down
21 changes: 15 additions & 6 deletions trunk/fs/proc/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -297,16 +297,20 @@ static int proc_fd_link(struct inode *inode, struct dentry **dentry, struct vfsm

files = get_files_struct(task);
if (files) {
rcu_read_lock();
/*
* We are not taking a ref to the file structure, so we must
* hold ->file_lock.
*/
spin_lock(&files->file_lock);
file = fcheck_files(files, fd);
if (file) {
*mnt = mntget(file->f_vfsmnt);
*dentry = dget(file->f_dentry);
rcu_read_unlock();
spin_unlock(&files->file_lock);
put_files_struct(files);
return 0;
}
rcu_read_unlock();
spin_unlock(&files->file_lock);
put_files_struct(files);
}
return -ENOENT;
Expand Down Expand Up @@ -1523,15 +1527,20 @@ static struct dentry *proc_lookupfd(struct inode * dir, struct dentry * dentry,
if (!files)
goto out_unlock;
inode->i_mode = S_IFLNK;
rcu_read_lock();

/*
* We are not taking a ref to the file structure, so we must
* hold ->file_lock.
*/
spin_lock(&files->file_lock);
file = fcheck_files(files, fd);
if (!file)
goto out_unlock2;
if (file->f_mode & 1)
inode->i_mode |= S_IRUSR | S_IXUSR;
if (file->f_mode & 2)
inode->i_mode |= S_IWUSR | S_IXUSR;
rcu_read_unlock();
spin_unlock(&files->file_lock);
put_files_struct(files);
inode->i_op = &proc_pid_link_inode_operations;
inode->i_size = 64;
Expand All @@ -1541,7 +1550,7 @@ static struct dentry *proc_lookupfd(struct inode * dir, struct dentry * dentry,
return NULL;

out_unlock2:
rcu_read_unlock();
spin_unlock(&files->file_lock);
put_files_struct(files);
out_unlock:
iput(inode);
Expand Down

0 comments on commit 2f0b7a8

Please sign in to comment.