Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 28567
b: refs/heads/master
c: c89681e
h: refs/heads/master
i:
  28565: 1af024f
  28563: 2b56f85
  28559: e11612c
v: v3
  • Loading branch information
Miklos Szeredi authored and Linus Torvalds committed Jun 22, 2006
1 parent 3ac73d0 commit ef85065
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 62 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: 09d967c6f32b35eab15b45862ae16e4f06259d8e
refs/heads/master: c89681ed7d0e4a61d35bdc12c06c6733b718b2cb
1 change: 0 additions & 1 deletion trunk/fs/binfmt_elf.c
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,6 @@ static int load_elf_binary(struct linux_binprm * bprm, struct pt_regs * regs)

/* Discard our unneeded old files struct */
if (files) {
steal_locks(files);
put_files_struct(files);
files = NULL;
}
Expand Down
1 change: 0 additions & 1 deletion trunk/fs/binfmt_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ static int load_misc_binary(struct linux_binprm *bprm, struct pt_regs *regs)
goto _error;

if (files) {
steal_locks(files);
put_files_struct(files);
files = NULL;
}
Expand Down
1 change: 0 additions & 1 deletion trunk/fs/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,6 @@ int flush_old_exec(struct linux_binprm * bprm)
bprm->mm = NULL; /* We're using it now */

/* This is the point of no return */
steal_locks(files);
put_files_struct(files);

current->sas_ss_sp = current->sas_ss_size = 0;
Expand Down
57 changes: 0 additions & 57 deletions trunk/fs/locks.c
Original file line number Diff line number Diff line change
Expand Up @@ -2206,63 +2206,6 @@ int lock_may_write(struct inode *inode, loff_t start, unsigned long len)

EXPORT_SYMBOL(lock_may_write);

static inline void __steal_locks(struct file *file, fl_owner_t from)
{
struct inode *inode = file->f_dentry->d_inode;
struct file_lock *fl = inode->i_flock;

while (fl) {
if (fl->fl_file == file && fl->fl_owner == from)
fl->fl_owner = current->files;
fl = fl->fl_next;
}
}

/* When getting ready for executing a binary, we make sure that current
* has a files_struct on its own. Before dropping the old files_struct,
* we take over ownership of all locks for all file descriptors we own.
* Note that we may accidentally steal a lock for a file that a sibling
* has created since the unshare_files() call.
*/
void steal_locks(fl_owner_t from)
{
struct files_struct *files = current->files;
int i, j;
struct fdtable *fdt;

if (from == files)
return;

lock_kernel();
j = 0;

/*
* 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;
i = j * __NFDBITS;
if (i >= fdt->max_fdset || i >= fdt->max_fds)
break;
set = fdt->open_fds->fds_bits[j++];
while (set) {
if (set & 1) {
struct file *file = fdt->fd[i];
if (file)
__steal_locks(file, from);
}
i++;
set >>= 1;
}
}
spin_unlock(&files->file_lock);
unlock_kernel();
}
EXPORT_SYMBOL(steal_locks);

static int __init filelock_init(void)
{
filelock_cache = kmem_cache_create("file_lock_cache",
Expand Down
1 change: 0 additions & 1 deletion trunk/include/linux/fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,6 @@ extern int setlease(struct file *, long, struct file_lock **);
extern int lease_modify(struct file_lock **, int);
extern int lock_may_read(struct inode *, loff_t start, unsigned long count);
extern int lock_may_write(struct inode *, loff_t start, unsigned long count);
extern void steal_locks(fl_owner_t from);

struct fasync_struct {
int magic;
Expand Down

0 comments on commit ef85065

Please sign in to comment.