aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDave Kleikamp <shaggy@austin.ibm.com>2005-07-28 10:03:36 -0400
committerDave Kleikamp <shaggy@austin.ibm.com>2005-07-28 10:03:36 -0400
commitda28c12089dfcfb8695b6b555cdb8e03dda2b690 (patch)
treeb3ff509f21352ef053cb3d490cb13528090d32ac /fs
parent6de7dc2c4c713d037c19aa1e310d240f16973414 (diff)
parent577a4f8102d54b504cb22eb021b89e957e8df18f (diff)
Merge with /home/shaggy/git/linus-clean/
/home/shaggy/git/linus-clean/ /home/shaggy/git/linus-clean/ Signed-off-by: Dave Kleikamp <shaggy@austin.ibm.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/autofs4/autofs_i.h1
-rw-r--r--fs/autofs4/inode.c73
-rw-r--r--fs/ext2/ialloc.c1
-rw-r--r--fs/ext2/xattr.c2
-rw-r--r--fs/ext2/xip.c2
-rw-r--r--fs/ext3/ialloc.c2
-rw-r--r--fs/ext3/xattr.c2
-rw-r--r--fs/fcntl.c5
-rw-r--r--fs/jffs/intrep.c3
-rw-r--r--fs/locks.c81
-rw-r--r--fs/mbcache.c3
-rw-r--r--fs/ntfs/sysctl.h2
-rw-r--r--fs/reiserfs/inode.c12
-rw-r--r--fs/reiserfs/journal.c4
-rw-r--r--fs/reiserfs/xattr.c1
15 files changed, 149 insertions, 45 deletions
diff --git a/fs/autofs4/autofs_i.h b/fs/autofs4/autofs_i.h
index 9c09641ce907..fca83e28edcf 100644
--- a/fs/autofs4/autofs_i.h
+++ b/fs/autofs4/autofs_i.h
@@ -92,6 +92,7 @@ struct autofs_wait_queue {
92 92
93struct autofs_sb_info { 93struct autofs_sb_info {
94 u32 magic; 94 u32 magic;
95 struct dentry *root;
95 struct file *pipe; 96 struct file *pipe;
96 pid_t oz_pgrp; 97 pid_t oz_pgrp;
97 int catatonic; 98 int catatonic;
diff --git a/fs/autofs4/inode.c b/fs/autofs4/inode.c
index 4bb14cc68040..0a3c05d10167 100644
--- a/fs/autofs4/inode.c
+++ b/fs/autofs4/inode.c
@@ -16,6 +16,7 @@
16#include <linux/pagemap.h> 16#include <linux/pagemap.h>
17#include <linux/parser.h> 17#include <linux/parser.h>
18#include <linux/bitops.h> 18#include <linux/bitops.h>
19#include <linux/smp_lock.h>
19#include "autofs_i.h" 20#include "autofs_i.h"
20#include <linux/module.h> 21#include <linux/module.h>
21 22
@@ -76,6 +77,66 @@ void autofs4_free_ino(struct autofs_info *ino)
76 kfree(ino); 77 kfree(ino);
77} 78}
78 79
80/*
81 * Deal with the infamous "Busy inodes after umount ..." message.
82 *
83 * Clean up the dentry tree. This happens with autofs if the user
84 * space program goes away due to a SIGKILL, SIGSEGV etc.
85 */
86static void autofs4_force_release(struct autofs_sb_info *sbi)
87{
88 struct dentry *this_parent = sbi->root;
89 struct list_head *next;
90
91 spin_lock(&dcache_lock);
92repeat:
93 next = this_parent->d_subdirs.next;
94resume:
95 while (next != &this_parent->d_subdirs) {
96 struct dentry *dentry = list_entry(next, struct dentry, d_child);
97
98 /* Negative dentry - don`t care */
99 if (!simple_positive(dentry)) {
100 next = next->next;
101 continue;
102 }
103
104 if (!list_empty(&dentry->d_subdirs)) {
105 this_parent = dentry;
106 goto repeat;
107 }
108
109 next = next->next;
110 spin_unlock(&dcache_lock);
111
112 DPRINTK("dentry %p %.*s",
113 dentry, (int)dentry->d_name.len, dentry->d_name.name);
114
115 dput(dentry);
116 spin_lock(&dcache_lock);
117 }
118
119 if (this_parent != sbi->root) {
120 struct dentry *dentry = this_parent;
121
122 next = this_parent->d_child.next;
123 this_parent = this_parent->d_parent;
124 spin_unlock(&dcache_lock);
125 DPRINTK("parent dentry %p %.*s",
126 dentry, (int)dentry->d_name.len, dentry->d_name.name);
127 dput(dentry);
128 spin_lock(&dcache_lock);
129 goto resume;
130 }
131 spin_unlock(&dcache_lock);
132
133 dput(sbi->root);
134 sbi->root = NULL;
135 shrink_dcache_sb(sbi->sb);
136
137 return;
138}
139
79static void autofs4_put_super(struct super_block *sb) 140static void autofs4_put_super(struct super_block *sb)
80{ 141{
81 struct autofs_sb_info *sbi = autofs4_sbi(sb); 142 struct autofs_sb_info *sbi = autofs4_sbi(sb);
@@ -85,6 +146,10 @@ static void autofs4_put_super(struct super_block *sb)
85 if ( !sbi->catatonic ) 146 if ( !sbi->catatonic )
86 autofs4_catatonic_mode(sbi); /* Free wait queues, close pipe */ 147 autofs4_catatonic_mode(sbi); /* Free wait queues, close pipe */
87 148
149 /* Clean up and release dangling references */
150 if (sbi)
151 autofs4_force_release(sbi);
152
88 kfree(sbi); 153 kfree(sbi);
89 154
90 DPRINTK("shutting down"); 155 DPRINTK("shutting down");
@@ -199,6 +264,7 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
199 264
200 s->s_fs_info = sbi; 265 s->s_fs_info = sbi;
201 sbi->magic = AUTOFS_SBI_MAGIC; 266 sbi->magic = AUTOFS_SBI_MAGIC;
267 sbi->root = NULL;
202 sbi->catatonic = 0; 268 sbi->catatonic = 0;
203 sbi->exp_timeout = 0; 269 sbi->exp_timeout = 0;
204 sbi->oz_pgrp = process_group(current); 270 sbi->oz_pgrp = process_group(current);
@@ -267,6 +333,13 @@ int autofs4_fill_super(struct super_block *s, void *data, int silent)
267 sbi->pipe = pipe; 333 sbi->pipe = pipe;
268 334
269 /* 335 /*
336 * Take a reference to the root dentry so we get a chance to
337 * clean up the dentry tree on umount.
338 * See autofs4_force_release.
339 */
340 sbi->root = dget(root);
341
342 /*
270 * Success! Install the root dentry now to indicate completion. 343 * Success! Install the root dentry now to indicate completion.
271 */ 344 */
272 s->s_root = root; 345 s->s_root = root;
diff --git a/fs/ext2/ialloc.c b/fs/ext2/ialloc.c
index 77e059149212..161f156d98c8 100644
--- a/fs/ext2/ialloc.c
+++ b/fs/ext2/ialloc.c
@@ -612,6 +612,7 @@ got:
612 err = ext2_init_acl(inode, dir); 612 err = ext2_init_acl(inode, dir);
613 if (err) { 613 if (err) {
614 DQUOT_FREE_INODE(inode); 614 DQUOT_FREE_INODE(inode);
615 DQUOT_DROP(inode);
615 goto fail2; 616 goto fail2;
616 } 617 }
617 mark_inode_dirty(inode); 618 mark_inode_dirty(inode);
diff --git a/fs/ext2/xattr.c b/fs/ext2/xattr.c
index 27982b500e84..0099462d4271 100644
--- a/fs/ext2/xattr.c
+++ b/fs/ext2/xattr.c
@@ -823,7 +823,7 @@ cleanup:
823void 823void
824ext2_xattr_put_super(struct super_block *sb) 824ext2_xattr_put_super(struct super_block *sb)
825{ 825{
826 mb_cache_shrink(ext2_xattr_cache, sb->s_bdev); 826 mb_cache_shrink(sb->s_bdev);
827} 827}
828 828
829 829
diff --git a/fs/ext2/xip.c b/fs/ext2/xip.c
index 0aa5ac159c09..ca7f00312388 100644
--- a/fs/ext2/xip.c
+++ b/fs/ext2/xip.c
@@ -36,7 +36,7 @@ __ext2_get_sector(struct inode *inode, sector_t offset, int create,
36 *result = tmp.b_blocknr; 36 *result = tmp.b_blocknr;
37 37
38 /* did we get a sparse block (hole in the file)? */ 38 /* did we get a sparse block (hole in the file)? */
39 if (!(*result)) { 39 if (!tmp.b_blocknr && !rc) {
40 BUG_ON(create); 40 BUG_ON(create);
41 rc = -ENODATA; 41 rc = -ENODATA;
42 } 42 }
diff --git a/fs/ext3/ialloc.c b/fs/ext3/ialloc.c
index 1e6f3ea28713..6981bd014ede 100644
--- a/fs/ext3/ialloc.c
+++ b/fs/ext3/ialloc.c
@@ -604,12 +604,14 @@ got:
604 err = ext3_init_acl(handle, inode, dir); 604 err = ext3_init_acl(handle, inode, dir);
605 if (err) { 605 if (err) {
606 DQUOT_FREE_INODE(inode); 606 DQUOT_FREE_INODE(inode);
607 DQUOT_DROP(inode);
607 goto fail2; 608 goto fail2;
608 } 609 }
609 err = ext3_mark_inode_dirty(handle, inode); 610 err = ext3_mark_inode_dirty(handle, inode);
610 if (err) { 611 if (err) {
611 ext3_std_error(sb, err); 612 ext3_std_error(sb, err);
612 DQUOT_FREE_INODE(inode); 613 DQUOT_FREE_INODE(inode);
614 DQUOT_DROP(inode);
613 goto fail2; 615 goto fail2;
614 } 616 }
615 617
diff --git a/fs/ext3/xattr.c b/fs/ext3/xattr.c
index 3f9dfa643b19..269c7b92db9a 100644
--- a/fs/ext3/xattr.c
+++ b/fs/ext3/xattr.c
@@ -1106,7 +1106,7 @@ cleanup:
1106void 1106void
1107ext3_xattr_put_super(struct super_block *sb) 1107ext3_xattr_put_super(struct super_block *sb)
1108{ 1108{
1109 mb_cache_shrink(ext3_xattr_cache, sb->s_bdev); 1109 mb_cache_shrink(sb->s_bdev);
1110} 1110}
1111 1111
1112/* 1112/*
diff --git a/fs/fcntl.c b/fs/fcntl.c
index 286a9f8f3d49..6fbc9d8fcc36 100644
--- a/fs/fcntl.c
+++ b/fs/fcntl.c
@@ -288,7 +288,7 @@ static long do_fcntl(int fd, unsigned int cmd, unsigned long arg,
288 break; 288 break;
289 case F_SETLK: 289 case F_SETLK:
290 case F_SETLKW: 290 case F_SETLKW:
291 err = fcntl_setlk(filp, cmd, (struct flock __user *) arg); 291 err = fcntl_setlk(fd, filp, cmd, (struct flock __user *) arg);
292 break; 292 break;
293 case F_GETOWN: 293 case F_GETOWN:
294 /* 294 /*
@@ -376,7 +376,8 @@ asmlinkage long sys_fcntl64(unsigned int fd, unsigned int cmd, unsigned long arg
376 break; 376 break;
377 case F_SETLK64: 377 case F_SETLK64:
378 case F_SETLKW64: 378 case F_SETLKW64:
379 err = fcntl_setlk64(filp, cmd, (struct flock64 __user *) arg); 379 err = fcntl_setlk64(fd, filp, cmd,
380 (struct flock64 __user *) arg);
380 break; 381 break;
381 default: 382 default:
382 err = do_fcntl(fd, cmd, arg, filp); 383 err = do_fcntl(fd, cmd, arg, filp);
diff --git a/fs/jffs/intrep.c b/fs/jffs/intrep.c
index fc589ddd0762..456d7e6e29c2 100644
--- a/fs/jffs/intrep.c
+++ b/fs/jffs/intrep.c
@@ -3397,6 +3397,9 @@ jffs_garbage_collect_thread(void *ptr)
3397 siginfo_t info; 3397 siginfo_t info;
3398 unsigned long signr = 0; 3398 unsigned long signr = 0;
3399 3399
3400 if (try_to_freeze())
3401 continue;
3402
3400 spin_lock_irq(&current->sighand->siglock); 3403 spin_lock_irq(&current->sighand->siglock);
3401 signr = dequeue_signal(current, &current->blocked, &info); 3404 signr = dequeue_signal(current, &current->blocked, &info);
3402 spin_unlock_irq(&current->sighand->siglock); 3405 spin_unlock_irq(&current->sighand->siglock);
diff --git a/fs/locks.c b/fs/locks.c
index 29fa5da6c117..11956b6179ff 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1591,7 +1591,8 @@ out:
1591/* Apply the lock described by l to an open file descriptor. 1591/* Apply the lock described by l to an open file descriptor.
1592 * This implements both the F_SETLK and F_SETLKW commands of fcntl(). 1592 * This implements both the F_SETLK and F_SETLKW commands of fcntl().
1593 */ 1593 */
1594int fcntl_setlk(struct file *filp, unsigned int cmd, struct flock __user *l) 1594int fcntl_setlk(unsigned int fd, struct file *filp, unsigned int cmd,
1595 struct flock __user *l)
1595{ 1596{
1596 struct file_lock *file_lock = locks_alloc_lock(); 1597 struct file_lock *file_lock = locks_alloc_lock();
1597 struct flock flock; 1598 struct flock flock;
@@ -1620,6 +1621,7 @@ int fcntl_setlk(struct file *filp, unsigned int cmd, struct flock __user *l)
1620 goto out; 1621 goto out;
1621 } 1622 }
1622 1623
1624again:
1623 error = flock_to_posix_lock(filp, file_lock, &flock); 1625 error = flock_to_posix_lock(filp, file_lock, &flock);
1624 if (error) 1626 if (error)
1625 goto out; 1627 goto out;
@@ -1648,25 +1650,33 @@ int fcntl_setlk(struct file *filp, unsigned int cmd, struct flock __user *l)
1648 if (error) 1650 if (error)
1649 goto out; 1651 goto out;
1650 1652
1651 if (filp->f_op && filp->f_op->lock != NULL) { 1653 if (filp->f_op && filp->f_op->lock != NULL)
1652 error = filp->f_op->lock(filp, cmd, file_lock); 1654 error = filp->f_op->lock(filp, cmd, file_lock);
1653 goto out; 1655 else {
1654 } 1656 for (;;) {
1657 error = __posix_lock_file(inode, file_lock);
1658 if ((error != -EAGAIN) || (cmd == F_SETLK))
1659 break;
1660 error = wait_event_interruptible(file_lock->fl_wait,
1661 !file_lock->fl_next);
1662 if (!error)
1663 continue;
1655 1664
1656 for (;;) { 1665 locks_delete_block(file_lock);
1657 error = __posix_lock_file(inode, file_lock);
1658 if ((error != -EAGAIN) || (cmd == F_SETLK))
1659 break; 1666 break;
1660 error = wait_event_interruptible(file_lock->fl_wait, 1667 }
1661 !file_lock->fl_next); 1668 }
1662 if (!error)
1663 continue;
1664 1669
1665 locks_delete_block(file_lock); 1670 /*
1666 break; 1671 * Attempt to detect a close/fcntl race and recover by
1672 * releasing the lock that was just acquired.
1673 */
1674 if (!error && fcheck(fd) != filp && flock.l_type != F_UNLCK) {
1675 flock.l_type = F_UNLCK;
1676 goto again;
1667 } 1677 }
1668 1678
1669 out: 1679out:
1670 locks_free_lock(file_lock); 1680 locks_free_lock(file_lock);
1671 return error; 1681 return error;
1672} 1682}
@@ -1724,7 +1734,8 @@ out:
1724/* Apply the lock described by l to an open file descriptor. 1734/* Apply the lock described by l to an open file descriptor.
1725 * This implements both the F_SETLK and F_SETLKW commands of fcntl(). 1735 * This implements both the F_SETLK and F_SETLKW commands of fcntl().
1726 */ 1736 */
1727int fcntl_setlk64(struct file *filp, unsigned int cmd, struct flock64 __user *l) 1737int fcntl_setlk64(unsigned int fd, struct file *filp, unsigned int cmd,
1738 struct flock64 __user *l)
1728{ 1739{
1729 struct file_lock *file_lock = locks_alloc_lock(); 1740 struct file_lock *file_lock = locks_alloc_lock();
1730 struct flock64 flock; 1741 struct flock64 flock;
@@ -1753,6 +1764,7 @@ int fcntl_setlk64(struct file *filp, unsigned int cmd, struct flock64 __user *l)
1753 goto out; 1764 goto out;
1754 } 1765 }
1755 1766
1767again:
1756 error = flock64_to_posix_lock(filp, file_lock, &flock); 1768 error = flock64_to_posix_lock(filp, file_lock, &flock);
1757 if (error) 1769 if (error)
1758 goto out; 1770 goto out;
@@ -1781,22 +1793,30 @@ int fcntl_setlk64(struct file *filp, unsigned int cmd, struct flock64 __user *l)
1781 if (error) 1793 if (error)
1782 goto out; 1794 goto out;
1783 1795
1784 if (filp->f_op && filp->f_op->lock != NULL) { 1796 if (filp->f_op && filp->f_op->lock != NULL)
1785 error = filp->f_op->lock(filp, cmd, file_lock); 1797 error = filp->f_op->lock(filp, cmd, file_lock);
1786 goto out; 1798 else {
1787 } 1799 for (;;) {
1800 error = __posix_lock_file(inode, file_lock);
1801 if ((error != -EAGAIN) || (cmd == F_SETLK64))
1802 break;
1803 error = wait_event_interruptible(file_lock->fl_wait,
1804 !file_lock->fl_next);
1805 if (!error)
1806 continue;
1788 1807
1789 for (;;) { 1808 locks_delete_block(file_lock);
1790 error = __posix_lock_file(inode, file_lock);
1791 if ((error != -EAGAIN) || (cmd == F_SETLK64))
1792 break; 1809 break;
1793 error = wait_event_interruptible(file_lock->fl_wait, 1810 }
1794 !file_lock->fl_next); 1811 }
1795 if (!error)
1796 continue;
1797 1812
1798 locks_delete_block(file_lock); 1813 /*
1799 break; 1814 * Attempt to detect a close/fcntl race and recover by
1815 * releasing the lock that was just acquired.
1816 */
1817 if (!error && fcheck(fd) != filp && flock.l_type != F_UNLCK) {
1818 flock.l_type = F_UNLCK;
1819 goto again;
1800 } 1820 }
1801 1821
1802out: 1822out:
@@ -1888,12 +1908,7 @@ void locks_remove_flock(struct file *filp)
1888 1908
1889 while ((fl = *before) != NULL) { 1909 while ((fl = *before) != NULL) {
1890 if (fl->fl_file == filp) { 1910 if (fl->fl_file == filp) {
1891 /* 1911 if (IS_FLOCK(fl)) {
1892 * We might have a POSIX lock that was created at the same time
1893 * the filp was closed for the last time. Just remove that too,
1894 * regardless of ownership, since nobody can own it.
1895 */
1896 if (IS_FLOCK(fl) || IS_POSIX(fl)) {
1897 locks_delete_lock(before); 1912 locks_delete_lock(before);
1898 continue; 1913 continue;
1899 } 1914 }
diff --git a/fs/mbcache.c b/fs/mbcache.c
index c7170b9221a3..b002a088857d 100644
--- a/fs/mbcache.c
+++ b/fs/mbcache.c
@@ -316,11 +316,10 @@ fail:
316 * currently in use cannot be freed, and thus remain in the cache. All others 316 * currently in use cannot be freed, and thus remain in the cache. All others
317 * are freed. 317 * are freed.
318 * 318 *
319 * @cache: which cache to shrink
320 * @bdev: which device's cache entries to shrink 319 * @bdev: which device's cache entries to shrink
321 */ 320 */
322void 321void
323mb_cache_shrink(struct mb_cache *cache, struct block_device *bdev) 322mb_cache_shrink(struct block_device *bdev)
324{ 323{
325 LIST_HEAD(free_list); 324 LIST_HEAD(free_list);
326 struct list_head *l, *ltmp; 325 struct list_head *l, *ltmp;
diff --git a/fs/ntfs/sysctl.h b/fs/ntfs/sysctl.h
index df749cc0aac8..c8064cae8f17 100644
--- a/fs/ntfs/sysctl.h
+++ b/fs/ntfs/sysctl.h
@@ -26,7 +26,7 @@
26 26
27#include <linux/config.h> 27#include <linux/config.h>
28 28
29#if (DEBUG && CONFIG_SYSCTL) 29#if defined(DEBUG) && defined(CONFIG_SYSCTL)
30 30
31extern int ntfs_sysctl(int add); 31extern int ntfs_sysctl(int add);
32 32
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c
index 1aaf2c7d44e6..d9f614a57731 100644
--- a/fs/reiserfs/inode.c
+++ b/fs/reiserfs/inode.c
@@ -1980,7 +1980,17 @@ int reiserfs_new_inode(struct reiserfs_transaction_handle *th,
1980 out_inserted_sd: 1980 out_inserted_sd:
1981 inode->i_nlink = 0; 1981 inode->i_nlink = 0;
1982 th->t_trans_id = 0; /* so the caller can't use this handle later */ 1982 th->t_trans_id = 0; /* so the caller can't use this handle later */
1983 iput(inode); 1983
1984 /* If we were inheriting an ACL, we need to release the lock so that
1985 * iput doesn't deadlock in reiserfs_delete_xattrs. The locking
1986 * code really needs to be reworked, but this will take care of it
1987 * for now. -jeffm */
1988 if (REISERFS_I(dir)->i_acl_default) {
1989 reiserfs_write_unlock_xattrs(dir->i_sb);
1990 iput(inode);
1991 reiserfs_write_lock_xattrs(dir->i_sb);
1992 } else
1993 iput(inode);
1984 return err; 1994 return err;
1985} 1995}
1986 1996
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
index c66c27ec4100..ca7989b04be3 100644
--- a/fs/reiserfs/journal.c
+++ b/fs/reiserfs/journal.c
@@ -556,14 +556,14 @@ static inline void insert_journal_hash(struct reiserfs_journal_cnode **table,
556} 556}
557 557
558/* lock the current transaction */ 558/* lock the current transaction */
559inline static void lock_journal(struct super_block *p_s_sb) 559static inline void lock_journal(struct super_block *p_s_sb)
560{ 560{
561 PROC_INFO_INC(p_s_sb, journal.lock_journal); 561 PROC_INFO_INC(p_s_sb, journal.lock_journal);
562 down(&SB_JOURNAL(p_s_sb)->j_lock); 562 down(&SB_JOURNAL(p_s_sb)->j_lock);
563} 563}
564 564
565/* unlock the current transaction */ 565/* unlock the current transaction */
566inline static void unlock_journal(struct super_block *p_s_sb) 566static inline void unlock_journal(struct super_block *p_s_sb)
567{ 567{
568 up(&SB_JOURNAL(p_s_sb)->j_lock); 568 up(&SB_JOURNAL(p_s_sb)->j_lock);
569} 569}
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index e386d3db3051..87ac9dc8b381 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -39,7 +39,6 @@
39#include <linux/xattr.h> 39#include <linux/xattr.h>
40#include <linux/reiserfs_xattr.h> 40#include <linux/reiserfs_xattr.h>
41#include <linux/reiserfs_acl.h> 41#include <linux/reiserfs_acl.h>
42#include <linux/mbcache.h>
43#include <asm/uaccess.h> 42#include <asm/uaccess.h>
44#include <asm/checksum.h> 43#include <asm/checksum.h>
45#include <linux/smp_lock.h> 44#include <linux/smp_lock.h>