diff options
Diffstat (limited to 'fs/reiserfs')
-rw-r--r-- | fs/reiserfs/inode.c | 2 | ||||
-rw-r--r-- | fs/reiserfs/journal.c | 48 | ||||
-rw-r--r-- | fs/reiserfs/super.c | 139 | ||||
-rw-r--r-- | fs/reiserfs/xattr.c | 2 | ||||
-rw-r--r-- | fs/reiserfs/xattr_security.c | 2 | ||||
-rw-r--r-- | fs/reiserfs/xattr_trusted.c | 2 | ||||
-rw-r--r-- | fs/reiserfs/xattr_user.c | 2 |
7 files changed, 120 insertions, 77 deletions
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index 192269698a8a..5699171212ae 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -2435,7 +2435,7 @@ static int reiserfs_write_full_page(struct page *page, | |||
2435 | if (wbc->sync_mode != WB_SYNC_NONE || !wbc->nonblocking) { | 2435 | if (wbc->sync_mode != WB_SYNC_NONE || !wbc->nonblocking) { |
2436 | lock_buffer(bh); | 2436 | lock_buffer(bh); |
2437 | } else { | 2437 | } else { |
2438 | if (test_set_buffer_locked(bh)) { | 2438 | if (!trylock_buffer(bh)) { |
2439 | redirty_page_for_writepage(wbc, page); | 2439 | redirty_page_for_writepage(wbc, page); |
2440 | continue; | 2440 | continue; |
2441 | } | 2441 | } |
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index e396b2fa4743..c21df71943a6 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c | |||
@@ -34,15 +34,10 @@ | |||
34 | ** from within kupdate, it will ignore the immediate flag | 34 | ** from within kupdate, it will ignore the immediate flag |
35 | */ | 35 | */ |
36 | 36 | ||
37 | #include <asm/uaccess.h> | ||
38 | #include <asm/system.h> | ||
39 | |||
40 | #include <linux/time.h> | 37 | #include <linux/time.h> |
41 | #include <linux/semaphore.h> | 38 | #include <linux/semaphore.h> |
42 | |||
43 | #include <linux/vmalloc.h> | 39 | #include <linux/vmalloc.h> |
44 | #include <linux/reiserfs_fs.h> | 40 | #include <linux/reiserfs_fs.h> |
45 | |||
46 | #include <linux/kernel.h> | 41 | #include <linux/kernel.h> |
47 | #include <linux/errno.h> | 42 | #include <linux/errno.h> |
48 | #include <linux/fcntl.h> | 43 | #include <linux/fcntl.h> |
@@ -54,6 +49,9 @@ | |||
54 | #include <linux/writeback.h> | 49 | #include <linux/writeback.h> |
55 | #include <linux/blkdev.h> | 50 | #include <linux/blkdev.h> |
56 | #include <linux/backing-dev.h> | 51 | #include <linux/backing-dev.h> |
52 | #include <linux/uaccess.h> | ||
53 | |||
54 | #include <asm/system.h> | ||
57 | 55 | ||
58 | /* gets a struct reiserfs_journal_list * from a list head */ | 56 | /* gets a struct reiserfs_journal_list * from a list head */ |
59 | #define JOURNAL_LIST_ENTRY(h) (list_entry((h), struct reiserfs_journal_list, \ | 57 | #define JOURNAL_LIST_ENTRY(h) (list_entry((h), struct reiserfs_journal_list, \ |
@@ -558,13 +556,13 @@ static inline void insert_journal_hash(struct reiserfs_journal_cnode **table, | |||
558 | static inline void lock_journal(struct super_block *p_s_sb) | 556 | static inline void lock_journal(struct super_block *p_s_sb) |
559 | { | 557 | { |
560 | PROC_INFO_INC(p_s_sb, journal.lock_journal); | 558 | PROC_INFO_INC(p_s_sb, journal.lock_journal); |
561 | down(&SB_JOURNAL(p_s_sb)->j_lock); | 559 | mutex_lock(&SB_JOURNAL(p_s_sb)->j_mutex); |
562 | } | 560 | } |
563 | 561 | ||
564 | /* unlock the current transaction */ | 562 | /* unlock the current transaction */ |
565 | static inline void unlock_journal(struct super_block *p_s_sb) | 563 | static inline void unlock_journal(struct super_block *p_s_sb) |
566 | { | 564 | { |
567 | up(&SB_JOURNAL(p_s_sb)->j_lock); | 565 | mutex_unlock(&SB_JOURNAL(p_s_sb)->j_mutex); |
568 | } | 566 | } |
569 | 567 | ||
570 | static inline void get_journal_list(struct reiserfs_journal_list *jl) | 568 | static inline void get_journal_list(struct reiserfs_journal_list *jl) |
@@ -629,7 +627,7 @@ static int journal_list_still_alive(struct super_block *s, | |||
629 | static void release_buffer_page(struct buffer_head *bh) | 627 | static void release_buffer_page(struct buffer_head *bh) |
630 | { | 628 | { |
631 | struct page *page = bh->b_page; | 629 | struct page *page = bh->b_page; |
632 | if (!page->mapping && !TestSetPageLocked(page)) { | 630 | if (!page->mapping && trylock_page(page)) { |
633 | page_cache_get(page); | 631 | page_cache_get(page); |
634 | put_bh(bh); | 632 | put_bh(bh); |
635 | if (!page->mapping) | 633 | if (!page->mapping) |
@@ -857,7 +855,7 @@ static int write_ordered_buffers(spinlock_t * lock, | |||
857 | jh = JH_ENTRY(list->next); | 855 | jh = JH_ENTRY(list->next); |
858 | bh = jh->bh; | 856 | bh = jh->bh; |
859 | get_bh(bh); | 857 | get_bh(bh); |
860 | if (test_set_buffer_locked(bh)) { | 858 | if (!trylock_buffer(bh)) { |
861 | if (!buffer_dirty(bh)) { | 859 | if (!buffer_dirty(bh)) { |
862 | list_move(&jh->list, &tmp); | 860 | list_move(&jh->list, &tmp); |
863 | goto loop_next; | 861 | goto loop_next; |
@@ -1045,9 +1043,9 @@ static int flush_commit_list(struct super_block *s, | |||
1045 | } | 1043 | } |
1046 | 1044 | ||
1047 | /* make sure nobody is trying to flush this one at the same time */ | 1045 | /* make sure nobody is trying to flush this one at the same time */ |
1048 | down(&jl->j_commit_lock); | 1046 | mutex_lock(&jl->j_commit_mutex); |
1049 | if (!journal_list_still_alive(s, trans_id)) { | 1047 | if (!journal_list_still_alive(s, trans_id)) { |
1050 | up(&jl->j_commit_lock); | 1048 | mutex_unlock(&jl->j_commit_mutex); |
1051 | goto put_jl; | 1049 | goto put_jl; |
1052 | } | 1050 | } |
1053 | BUG_ON(jl->j_trans_id == 0); | 1051 | BUG_ON(jl->j_trans_id == 0); |
@@ -1057,7 +1055,7 @@ static int flush_commit_list(struct super_block *s, | |||
1057 | if (flushall) { | 1055 | if (flushall) { |
1058 | atomic_set(&(jl->j_older_commits_done), 1); | 1056 | atomic_set(&(jl->j_older_commits_done), 1); |
1059 | } | 1057 | } |
1060 | up(&jl->j_commit_lock); | 1058 | mutex_unlock(&jl->j_commit_mutex); |
1061 | goto put_jl; | 1059 | goto put_jl; |
1062 | } | 1060 | } |
1063 | 1061 | ||
@@ -1181,7 +1179,7 @@ static int flush_commit_list(struct super_block *s, | |||
1181 | if (flushall) { | 1179 | if (flushall) { |
1182 | atomic_set(&(jl->j_older_commits_done), 1); | 1180 | atomic_set(&(jl->j_older_commits_done), 1); |
1183 | } | 1181 | } |
1184 | up(&jl->j_commit_lock); | 1182 | mutex_unlock(&jl->j_commit_mutex); |
1185 | put_jl: | 1183 | put_jl: |
1186 | put_journal_list(s, jl); | 1184 | put_journal_list(s, jl); |
1187 | 1185 | ||
@@ -1411,8 +1409,8 @@ static int flush_journal_list(struct super_block *s, | |||
1411 | 1409 | ||
1412 | /* if flushall == 0, the lock is already held */ | 1410 | /* if flushall == 0, the lock is already held */ |
1413 | if (flushall) { | 1411 | if (flushall) { |
1414 | down(&journal->j_flush_sem); | 1412 | mutex_lock(&journal->j_flush_mutex); |
1415 | } else if (!down_trylock(&journal->j_flush_sem)) { | 1413 | } else if (mutex_trylock(&journal->j_flush_mutex)) { |
1416 | BUG(); | 1414 | BUG(); |
1417 | } | 1415 | } |
1418 | 1416 | ||
@@ -1642,7 +1640,7 @@ static int flush_journal_list(struct super_block *s, | |||
1642 | jl->j_state = 0; | 1640 | jl->j_state = 0; |
1643 | put_journal_list(s, jl); | 1641 | put_journal_list(s, jl); |
1644 | if (flushall) | 1642 | if (flushall) |
1645 | up(&journal->j_flush_sem); | 1643 | mutex_unlock(&journal->j_flush_mutex); |
1646 | put_fs_excl(); | 1644 | put_fs_excl(); |
1647 | return err; | 1645 | return err; |
1648 | } | 1646 | } |
@@ -1772,12 +1770,12 @@ static int kupdate_transactions(struct super_block *s, | |||
1772 | struct reiserfs_journal *journal = SB_JOURNAL(s); | 1770 | struct reiserfs_journal *journal = SB_JOURNAL(s); |
1773 | chunk.nr = 0; | 1771 | chunk.nr = 0; |
1774 | 1772 | ||
1775 | down(&journal->j_flush_sem); | 1773 | mutex_lock(&journal->j_flush_mutex); |
1776 | if (!journal_list_still_alive(s, orig_trans_id)) { | 1774 | if (!journal_list_still_alive(s, orig_trans_id)) { |
1777 | goto done; | 1775 | goto done; |
1778 | } | 1776 | } |
1779 | 1777 | ||
1780 | /* we've got j_flush_sem held, nobody is going to delete any | 1778 | /* we've got j_flush_mutex held, nobody is going to delete any |
1781 | * of these lists out from underneath us | 1779 | * of these lists out from underneath us |
1782 | */ | 1780 | */ |
1783 | while ((num_trans && transactions_flushed < num_trans) || | 1781 | while ((num_trans && transactions_flushed < num_trans) || |
@@ -1812,7 +1810,7 @@ static int kupdate_transactions(struct super_block *s, | |||
1812 | } | 1810 | } |
1813 | 1811 | ||
1814 | done: | 1812 | done: |
1815 | up(&journal->j_flush_sem); | 1813 | mutex_unlock(&journal->j_flush_mutex); |
1816 | return ret; | 1814 | return ret; |
1817 | } | 1815 | } |
1818 | 1816 | ||
@@ -2556,7 +2554,7 @@ static struct reiserfs_journal_list *alloc_journal_list(struct super_block *s) | |||
2556 | INIT_LIST_HEAD(&jl->j_working_list); | 2554 | INIT_LIST_HEAD(&jl->j_working_list); |
2557 | INIT_LIST_HEAD(&jl->j_tail_bh_list); | 2555 | INIT_LIST_HEAD(&jl->j_tail_bh_list); |
2558 | INIT_LIST_HEAD(&jl->j_bh_list); | 2556 | INIT_LIST_HEAD(&jl->j_bh_list); |
2559 | sema_init(&jl->j_commit_lock, 1); | 2557 | mutex_init(&jl->j_commit_mutex); |
2560 | SB_JOURNAL(s)->j_num_lists++; | 2558 | SB_JOURNAL(s)->j_num_lists++; |
2561 | get_journal_list(jl); | 2559 | get_journal_list(jl); |
2562 | return jl; | 2560 | return jl; |
@@ -2837,8 +2835,8 @@ int journal_init(struct super_block *p_s_sb, const char *j_dev_name, | |||
2837 | journal->j_last = NULL; | 2835 | journal->j_last = NULL; |
2838 | journal->j_first = NULL; | 2836 | journal->j_first = NULL; |
2839 | init_waitqueue_head(&(journal->j_join_wait)); | 2837 | init_waitqueue_head(&(journal->j_join_wait)); |
2840 | sema_init(&journal->j_lock, 1); | 2838 | mutex_init(&journal->j_mutex); |
2841 | sema_init(&journal->j_flush_sem, 1); | 2839 | mutex_init(&journal->j_flush_mutex); |
2842 | 2840 | ||
2843 | journal->j_trans_id = 10; | 2841 | journal->j_trans_id = 10; |
2844 | journal->j_mount_id = 10; | 2842 | journal->j_mount_id = 10; |
@@ -3873,7 +3871,7 @@ int reiserfs_prepare_for_journal(struct super_block *p_s_sb, | |||
3873 | { | 3871 | { |
3874 | PROC_INFO_INC(p_s_sb, journal.prepare); | 3872 | PROC_INFO_INC(p_s_sb, journal.prepare); |
3875 | 3873 | ||
3876 | if (test_set_buffer_locked(bh)) { | 3874 | if (!trylock_buffer(bh)) { |
3877 | if (!wait) | 3875 | if (!wait) |
3878 | return 0; | 3876 | return 0; |
3879 | lock_buffer(bh); | 3877 | lock_buffer(bh); |
@@ -4030,7 +4028,7 @@ static int do_journal_end(struct reiserfs_transaction_handle *th, | |||
4030 | * the new transaction is fully setup, and we've already flushed the | 4028 | * the new transaction is fully setup, and we've already flushed the |
4031 | * ordered bh list | 4029 | * ordered bh list |
4032 | */ | 4030 | */ |
4033 | down(&jl->j_commit_lock); | 4031 | mutex_lock(&jl->j_commit_mutex); |
4034 | 4032 | ||
4035 | /* save the transaction id in case we need to commit it later */ | 4033 | /* save the transaction id in case we need to commit it later */ |
4036 | commit_trans_id = jl->j_trans_id; | 4034 | commit_trans_id = jl->j_trans_id; |
@@ -4196,7 +4194,7 @@ static int do_journal_end(struct reiserfs_transaction_handle *th, | |||
4196 | lock_kernel(); | 4194 | lock_kernel(); |
4197 | } | 4195 | } |
4198 | BUG_ON(!list_empty(&jl->j_tail_bh_list)); | 4196 | BUG_ON(!list_empty(&jl->j_tail_bh_list)); |
4199 | up(&jl->j_commit_lock); | 4197 | mutex_unlock(&jl->j_commit_mutex); |
4200 | 4198 | ||
4201 | /* honor the flush wishes from the caller, simple commits can | 4199 | /* honor the flush wishes from the caller, simple commits can |
4202 | ** be done outside the journal lock, they are done below | 4200 | ** be done outside the journal lock, they are done below |
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 1d40f2bd1970..d318c7e663fa 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
@@ -22,11 +22,11 @@ | |||
22 | #include <linux/blkdev.h> | 22 | #include <linux/blkdev.h> |
23 | #include <linux/buffer_head.h> | 23 | #include <linux/buffer_head.h> |
24 | #include <linux/exportfs.h> | 24 | #include <linux/exportfs.h> |
25 | #include <linux/quotaops.h> | ||
25 | #include <linux/vfs.h> | 26 | #include <linux/vfs.h> |
26 | #include <linux/mnt_namespace.h> | 27 | #include <linux/mnt_namespace.h> |
27 | #include <linux/mount.h> | 28 | #include <linux/mount.h> |
28 | #include <linux/namei.h> | 29 | #include <linux/namei.h> |
29 | #include <linux/quotaops.h> | ||
30 | 30 | ||
31 | struct file_system_type reiserfs_fs_type; | 31 | struct file_system_type reiserfs_fs_type; |
32 | 32 | ||
@@ -182,7 +182,7 @@ static int finish_unfinished(struct super_block *s) | |||
182 | int ret = reiserfs_quota_on_mount(s, i); | 182 | int ret = reiserfs_quota_on_mount(s, i); |
183 | if (ret < 0) | 183 | if (ret < 0) |
184 | reiserfs_warning(s, | 184 | reiserfs_warning(s, |
185 | "reiserfs: cannot turn on journalled quota: error %d", | 185 | "reiserfs: cannot turn on journaled quota: error %d", |
186 | ret); | 186 | ret); |
187 | } | 187 | } |
188 | } | 188 | } |
@@ -520,7 +520,7 @@ static void reiserfs_destroy_inode(struct inode *inode) | |||
520 | kmem_cache_free(reiserfs_inode_cachep, REISERFS_I(inode)); | 520 | kmem_cache_free(reiserfs_inode_cachep, REISERFS_I(inode)); |
521 | } | 521 | } |
522 | 522 | ||
523 | static void init_once(struct kmem_cache * cachep, void *foo) | 523 | static void init_once(void *foo) |
524 | { | 524 | { |
525 | struct reiserfs_inode_info *ei = (struct reiserfs_inode_info *)foo; | 525 | struct reiserfs_inode_info *ei = (struct reiserfs_inode_info *)foo; |
526 | 526 | ||
@@ -876,7 +876,9 @@ static int reiserfs_parse_options(struct super_block *s, char *options, /* strin | |||
876 | mount options were selected. */ | 876 | mount options were selected. */ |
877 | unsigned long *blocks, /* strtol-ed from NNN of resize=NNN */ | 877 | unsigned long *blocks, /* strtol-ed from NNN of resize=NNN */ |
878 | char **jdev_name, | 878 | char **jdev_name, |
879 | unsigned int *commit_max_age) | 879 | unsigned int *commit_max_age, |
880 | char **qf_names, | ||
881 | unsigned int *qfmt) | ||
880 | { | 882 | { |
881 | int c; | 883 | int c; |
882 | char *arg = NULL; | 884 | char *arg = NULL; |
@@ -992,9 +994,11 @@ static int reiserfs_parse_options(struct super_block *s, char *options, /* strin | |||
992 | if (c == 'u' || c == 'g') { | 994 | if (c == 'u' || c == 'g') { |
993 | int qtype = c == 'u' ? USRQUOTA : GRPQUOTA; | 995 | int qtype = c == 'u' ? USRQUOTA : GRPQUOTA; |
994 | 996 | ||
995 | if (sb_any_quota_enabled(s)) { | 997 | if ((sb_any_quota_enabled(s) || |
998 | sb_any_quota_suspended(s)) && | ||
999 | (!*arg != !REISERFS_SB(s)->s_qf_names[qtype])) { | ||
996 | reiserfs_warning(s, | 1000 | reiserfs_warning(s, |
997 | "reiserfs_parse_options: cannot change journalled quota options when quota turned on."); | 1001 | "reiserfs_parse_options: cannot change journaled quota options when quota turned on."); |
998 | return 0; | 1002 | return 0; |
999 | } | 1003 | } |
1000 | if (*arg) { /* Some filename specified? */ | 1004 | if (*arg) { /* Some filename specified? */ |
@@ -1011,46 +1015,54 @@ static int reiserfs_parse_options(struct super_block *s, char *options, /* strin | |||
1011 | "reiserfs_parse_options: quotafile must be on filesystem root."); | 1015 | "reiserfs_parse_options: quotafile must be on filesystem root."); |
1012 | return 0; | 1016 | return 0; |
1013 | } | 1017 | } |
1014 | REISERFS_SB(s)->s_qf_names[qtype] = | 1018 | qf_names[qtype] = |
1015 | kmalloc(strlen(arg) + 1, GFP_KERNEL); | 1019 | kmalloc(strlen(arg) + 1, GFP_KERNEL); |
1016 | if (!REISERFS_SB(s)->s_qf_names[qtype]) { | 1020 | if (!qf_names[qtype]) { |
1017 | reiserfs_warning(s, | 1021 | reiserfs_warning(s, |
1018 | "reiserfs_parse_options: not enough memory for storing quotafile name."); | 1022 | "reiserfs_parse_options: not enough memory for storing quotafile name."); |
1019 | return 0; | 1023 | return 0; |
1020 | } | 1024 | } |
1021 | strcpy(REISERFS_SB(s)->s_qf_names[qtype], arg); | 1025 | strcpy(qf_names[qtype], arg); |
1022 | *mount_options |= 1 << REISERFS_QUOTA; | 1026 | *mount_options |= 1 << REISERFS_QUOTA; |
1023 | } else { | 1027 | } else { |
1024 | kfree(REISERFS_SB(s)->s_qf_names[qtype]); | 1028 | if (qf_names[qtype] != |
1025 | REISERFS_SB(s)->s_qf_names[qtype] = NULL; | 1029 | REISERFS_SB(s)->s_qf_names[qtype]) |
1030 | kfree(qf_names[qtype]); | ||
1031 | qf_names[qtype] = NULL; | ||
1026 | } | 1032 | } |
1027 | } | 1033 | } |
1028 | if (c == 'f') { | 1034 | if (c == 'f') { |
1029 | if (!strcmp(arg, "vfsold")) | 1035 | if (!strcmp(arg, "vfsold")) |
1030 | REISERFS_SB(s)->s_jquota_fmt = QFMT_VFS_OLD; | 1036 | *qfmt = QFMT_VFS_OLD; |
1031 | else if (!strcmp(arg, "vfsv0")) | 1037 | else if (!strcmp(arg, "vfsv0")) |
1032 | REISERFS_SB(s)->s_jquota_fmt = QFMT_VFS_V0; | 1038 | *qfmt = QFMT_VFS_V0; |
1033 | else { | 1039 | else { |
1034 | reiserfs_warning(s, | 1040 | reiserfs_warning(s, |
1035 | "reiserfs_parse_options: unknown quota format specified."); | 1041 | "reiserfs_parse_options: unknown quota format specified."); |
1036 | return 0; | 1042 | return 0; |
1037 | } | 1043 | } |
1044 | if ((sb_any_quota_enabled(s) || | ||
1045 | sb_any_quota_suspended(s)) && | ||
1046 | *qfmt != REISERFS_SB(s)->s_jquota_fmt) { | ||
1047 | reiserfs_warning(s, | ||
1048 | "reiserfs_parse_options: cannot change journaled quota options when quota turned on."); | ||
1049 | return 0; | ||
1050 | } | ||
1038 | } | 1051 | } |
1039 | #else | 1052 | #else |
1040 | if (c == 'u' || c == 'g' || c == 'f') { | 1053 | if (c == 'u' || c == 'g' || c == 'f') { |
1041 | reiserfs_warning(s, | 1054 | reiserfs_warning(s, |
1042 | "reiserfs_parse_options: journalled quota options not supported."); | 1055 | "reiserfs_parse_options: journaled quota options not supported."); |
1043 | return 0; | 1056 | return 0; |
1044 | } | 1057 | } |
1045 | #endif | 1058 | #endif |
1046 | } | 1059 | } |
1047 | 1060 | ||
1048 | #ifdef CONFIG_QUOTA | 1061 | #ifdef CONFIG_QUOTA |
1049 | if (!REISERFS_SB(s)->s_jquota_fmt | 1062 | if (!REISERFS_SB(s)->s_jquota_fmt && !*qfmt |
1050 | && (REISERFS_SB(s)->s_qf_names[USRQUOTA] | 1063 | && (qf_names[USRQUOTA] || qf_names[GRPQUOTA])) { |
1051 | || REISERFS_SB(s)->s_qf_names[GRPQUOTA])) { | ||
1052 | reiserfs_warning(s, | 1064 | reiserfs_warning(s, |
1053 | "reiserfs_parse_options: journalled quota format not specified."); | 1065 | "reiserfs_parse_options: journaled quota format not specified."); |
1054 | return 0; | 1066 | return 0; |
1055 | } | 1067 | } |
1056 | /* This checking is not precise wrt the quota type but for our purposes it is sufficient */ | 1068 | /* This checking is not precise wrt the quota type but for our purposes it is sufficient */ |
@@ -1130,6 +1142,21 @@ static void handle_attrs(struct super_block *s) | |||
1130 | } | 1142 | } |
1131 | } | 1143 | } |
1132 | 1144 | ||
1145 | #ifdef CONFIG_QUOTA | ||
1146 | static void handle_quota_files(struct super_block *s, char **qf_names, | ||
1147 | unsigned int *qfmt) | ||
1148 | { | ||
1149 | int i; | ||
1150 | |||
1151 | for (i = 0; i < MAXQUOTAS; i++) { | ||
1152 | if (qf_names[i] != REISERFS_SB(s)->s_qf_names[i]) | ||
1153 | kfree(REISERFS_SB(s)->s_qf_names[i]); | ||
1154 | REISERFS_SB(s)->s_qf_names[i] = qf_names[i]; | ||
1155 | } | ||
1156 | REISERFS_SB(s)->s_jquota_fmt = *qfmt; | ||
1157 | } | ||
1158 | #endif | ||
1159 | |||
1133 | static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg) | 1160 | static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg) |
1134 | { | 1161 | { |
1135 | struct reiserfs_super_block *rs; | 1162 | struct reiserfs_super_block *rs; |
@@ -1141,23 +1168,30 @@ static int reiserfs_remount(struct super_block *s, int *mount_flags, char *arg) | |||
1141 | struct reiserfs_journal *journal = SB_JOURNAL(s); | 1168 | struct reiserfs_journal *journal = SB_JOURNAL(s); |
1142 | char *new_opts = kstrdup(arg, GFP_KERNEL); | 1169 | char *new_opts = kstrdup(arg, GFP_KERNEL); |
1143 | int err; | 1170 | int err; |
1171 | char *qf_names[MAXQUOTAS]; | ||
1172 | unsigned int qfmt = 0; | ||
1144 | #ifdef CONFIG_QUOTA | 1173 | #ifdef CONFIG_QUOTA |
1145 | int i; | 1174 | int i; |
1175 | |||
1176 | memcpy(qf_names, REISERFS_SB(s)->s_qf_names, sizeof(qf_names)); | ||
1146 | #endif | 1177 | #endif |
1147 | 1178 | ||
1148 | rs = SB_DISK_SUPER_BLOCK(s); | 1179 | rs = SB_DISK_SUPER_BLOCK(s); |
1149 | 1180 | ||
1150 | if (!reiserfs_parse_options | 1181 | if (!reiserfs_parse_options |
1151 | (s, arg, &mount_options, &blocks, NULL, &commit_max_age)) { | 1182 | (s, arg, &mount_options, &blocks, NULL, &commit_max_age, |
1183 | qf_names, &qfmt)) { | ||
1152 | #ifdef CONFIG_QUOTA | 1184 | #ifdef CONFIG_QUOTA |
1153 | for (i = 0; i < MAXQUOTAS; i++) { | 1185 | for (i = 0; i < MAXQUOTAS; i++) |
1154 | kfree(REISERFS_SB(s)->s_qf_names[i]); | 1186 | if (qf_names[i] != REISERFS_SB(s)->s_qf_names[i]) |
1155 | REISERFS_SB(s)->s_qf_names[i] = NULL; | 1187 | kfree(qf_names[i]); |
1156 | } | ||
1157 | #endif | 1188 | #endif |
1158 | err = -EINVAL; | 1189 | err = -EINVAL; |
1159 | goto out_err; | 1190 | goto out_err; |
1160 | } | 1191 | } |
1192 | #ifdef CONFIG_QUOTA | ||
1193 | handle_quota_files(s, qf_names, &qfmt); | ||
1194 | #endif | ||
1161 | 1195 | ||
1162 | handle_attrs(s); | 1196 | handle_attrs(s); |
1163 | 1197 | ||
@@ -1570,6 +1604,8 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent) | |||
1570 | char *jdev_name; | 1604 | char *jdev_name; |
1571 | struct reiserfs_sb_info *sbi; | 1605 | struct reiserfs_sb_info *sbi; |
1572 | int errval = -EINVAL; | 1606 | int errval = -EINVAL; |
1607 | char *qf_names[MAXQUOTAS] = {}; | ||
1608 | unsigned int qfmt = 0; | ||
1573 | 1609 | ||
1574 | save_mount_options(s, data); | 1610 | save_mount_options(s, data); |
1575 | 1611 | ||
@@ -1597,9 +1633,12 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent) | |||
1597 | jdev_name = NULL; | 1633 | jdev_name = NULL; |
1598 | if (reiserfs_parse_options | 1634 | if (reiserfs_parse_options |
1599 | (s, (char *)data, &(sbi->s_mount_opt), &blocks, &jdev_name, | 1635 | (s, (char *)data, &(sbi->s_mount_opt), &blocks, &jdev_name, |
1600 | &commit_max_age) == 0) { | 1636 | &commit_max_age, qf_names, &qfmt) == 0) { |
1601 | goto error; | 1637 | goto error; |
1602 | } | 1638 | } |
1639 | #ifdef CONFIG_QUOTA | ||
1640 | handle_quota_files(s, qf_names, &qfmt); | ||
1641 | #endif | ||
1603 | 1642 | ||
1604 | if (blocks) { | 1643 | if (blocks) { |
1605 | SWARN(silent, s, "jmacd-7: reiserfs_fill_super: resize option " | 1644 | SWARN(silent, s, "jmacd-7: reiserfs_fill_super: resize option " |
@@ -1819,7 +1858,7 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent) | |||
1819 | 1858 | ||
1820 | return (0); | 1859 | return (0); |
1821 | 1860 | ||
1822 | error: | 1861 | error: |
1823 | if (jinit_done) { /* kill the commit thread, free journal ram */ | 1862 | if (jinit_done) { /* kill the commit thread, free journal ram */ |
1824 | journal_release_error(NULL, s); | 1863 | journal_release_error(NULL, s); |
1825 | } | 1864 | } |
@@ -1830,10 +1869,8 @@ static int reiserfs_fill_super(struct super_block *s, void *data, int silent) | |||
1830 | #ifdef CONFIG_QUOTA | 1869 | #ifdef CONFIG_QUOTA |
1831 | { | 1870 | { |
1832 | int j; | 1871 | int j; |
1833 | for (j = 0; j < MAXQUOTAS; j++) { | 1872 | for (j = 0; j < MAXQUOTAS; j++) |
1834 | kfree(sbi->s_qf_names[j]); | 1873 | kfree(qf_names[j]); |
1835 | sbi->s_qf_names[j] = NULL; | ||
1836 | } | ||
1837 | } | 1874 | } |
1838 | #endif | 1875 | #endif |
1839 | kfree(sbi); | 1876 | kfree(sbi); |
@@ -1980,7 +2017,7 @@ static int reiserfs_release_dquot(struct dquot *dquot) | |||
1980 | 2017 | ||
1981 | static int reiserfs_mark_dquot_dirty(struct dquot *dquot) | 2018 | static int reiserfs_mark_dquot_dirty(struct dquot *dquot) |
1982 | { | 2019 | { |
1983 | /* Are we journalling quotas? */ | 2020 | /* Are we journaling quotas? */ |
1984 | if (REISERFS_SB(dquot->dq_sb)->s_qf_names[USRQUOTA] || | 2021 | if (REISERFS_SB(dquot->dq_sb)->s_qf_names[USRQUOTA] || |
1985 | REISERFS_SB(dquot->dq_sb)->s_qf_names[GRPQUOTA]) { | 2022 | REISERFS_SB(dquot->dq_sb)->s_qf_names[GRPQUOTA]) { |
1986 | dquot_mark_dquot_dirty(dquot); | 2023 | dquot_mark_dquot_dirty(dquot); |
@@ -2026,6 +2063,7 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, | |||
2026 | int err; | 2063 | int err; |
2027 | struct nameidata nd; | 2064 | struct nameidata nd; |
2028 | struct inode *inode; | 2065 | struct inode *inode; |
2066 | struct reiserfs_transaction_handle th; | ||
2029 | 2067 | ||
2030 | if (!(REISERFS_SB(sb)->s_mount_opt & (1 << REISERFS_QUOTA))) | 2068 | if (!(REISERFS_SB(sb)->s_mount_opt & (1 << REISERFS_QUOTA))) |
2031 | return -EINVAL; | 2069 | return -EINVAL; |
@@ -2037,8 +2075,8 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, | |||
2037 | return err; | 2075 | return err; |
2038 | /* Quotafile not on the same filesystem? */ | 2076 | /* Quotafile not on the same filesystem? */ |
2039 | if (nd.path.mnt->mnt_sb != sb) { | 2077 | if (nd.path.mnt->mnt_sb != sb) { |
2040 | path_put(&nd.path); | 2078 | err = -EXDEV; |
2041 | return -EXDEV; | 2079 | goto out; |
2042 | } | 2080 | } |
2043 | inode = nd.path.dentry->d_inode; | 2081 | inode = nd.path.dentry->d_inode; |
2044 | /* We must not pack tails for quota files on reiserfs for quota IO to work */ | 2082 | /* We must not pack tails for quota files on reiserfs for quota IO to work */ |
@@ -2048,24 +2086,37 @@ static int reiserfs_quota_on(struct super_block *sb, int type, int format_id, | |||
2048 | reiserfs_warning(sb, | 2086 | reiserfs_warning(sb, |
2049 | "reiserfs: Unpacking tail of quota file failed" | 2087 | "reiserfs: Unpacking tail of quota file failed" |
2050 | " (%d). Cannot turn on quotas.", err); | 2088 | " (%d). Cannot turn on quotas.", err); |
2051 | path_put(&nd.path); | 2089 | err = -EINVAL; |
2052 | return -EINVAL; | 2090 | goto out; |
2053 | } | 2091 | } |
2054 | mark_inode_dirty(inode); | 2092 | mark_inode_dirty(inode); |
2055 | } | 2093 | } |
2056 | /* Not journalling quota? No more tests needed... */ | 2094 | /* Journaling quota? */ |
2057 | if (!REISERFS_SB(sb)->s_qf_names[USRQUOTA] && | 2095 | if (REISERFS_SB(sb)->s_qf_names[type]) { |
2058 | !REISERFS_SB(sb)->s_qf_names[GRPQUOTA]) { | 2096 | /* Quotafile not of fs root? */ |
2059 | path_put(&nd.path); | 2097 | if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode) |
2060 | return vfs_quota_on(sb, type, format_id, path, 0); | 2098 | reiserfs_warning(sb, |
2061 | } | ||
2062 | /* Quotafile not of fs root? */ | ||
2063 | if (nd.path.dentry->d_parent->d_inode != sb->s_root->d_inode) | ||
2064 | reiserfs_warning(sb, | ||
2065 | "reiserfs: Quota file not on filesystem root. " | 2099 | "reiserfs: Quota file not on filesystem root. " |
2066 | "Journalled quota will not work."); | 2100 | "Journalled quota will not work."); |
2101 | } | ||
2102 | |||
2103 | /* | ||
2104 | * When we journal data on quota file, we have to flush journal to see | ||
2105 | * all updates to the file when we bypass pagecache... | ||
2106 | */ | ||
2107 | if (reiserfs_file_data_log(inode)) { | ||
2108 | /* Just start temporary transaction and finish it */ | ||
2109 | err = journal_begin(&th, sb, 1); | ||
2110 | if (err) | ||
2111 | goto out; | ||
2112 | err = journal_end_sync(&th, sb, 1); | ||
2113 | if (err) | ||
2114 | goto out; | ||
2115 | } | ||
2116 | err = vfs_quota_on_path(sb, type, format_id, &nd.path); | ||
2117 | out: | ||
2067 | path_put(&nd.path); | 2118 | path_put(&nd.path); |
2068 | return vfs_quota_on(sb, type, format_id, path, 0); | 2119 | return err; |
2069 | } | 2120 | } |
2070 | 2121 | ||
2071 | /* Read data from quotafile - avoid pagecache and such because we cannot afford | 2122 | /* Read data from quotafile - avoid pagecache and such because we cannot afford |
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c index d7c4935c1034..bb3cb5b7cdb2 100644 --- a/fs/reiserfs/xattr.c +++ b/fs/reiserfs/xattr.c | |||
@@ -1250,7 +1250,7 @@ static int reiserfs_check_acl(struct inode *inode, int mask) | |||
1250 | return error; | 1250 | return error; |
1251 | } | 1251 | } |
1252 | 1252 | ||
1253 | int reiserfs_permission(struct inode *inode, int mask, struct nameidata *nd) | 1253 | int reiserfs_permission(struct inode *inode, int mask) |
1254 | { | 1254 | { |
1255 | /* | 1255 | /* |
1256 | * We don't do permission checks on the internal objects. | 1256 | * We don't do permission checks on the internal objects. |
diff --git a/fs/reiserfs/xattr_security.c b/fs/reiserfs/xattr_security.c index 5e90a95ad60b..056008db1377 100644 --- a/fs/reiserfs/xattr_security.c +++ b/fs/reiserfs/xattr_security.c | |||
@@ -6,8 +6,6 @@ | |||
6 | #include <linux/reiserfs_xattr.h> | 6 | #include <linux/reiserfs_xattr.h> |
7 | #include <asm/uaccess.h> | 7 | #include <asm/uaccess.h> |
8 | 8 | ||
9 | #define XATTR_SECURITY_PREFIX "security." | ||
10 | |||
11 | static int | 9 | static int |
12 | security_get(struct inode *inode, const char *name, void *buffer, size_t size) | 10 | security_get(struct inode *inode, const char *name, void *buffer, size_t size) |
13 | { | 11 | { |
diff --git a/fs/reiserfs/xattr_trusted.c b/fs/reiserfs/xattr_trusted.c index 024a938ca60f..60abe2bb1f98 100644 --- a/fs/reiserfs/xattr_trusted.c +++ b/fs/reiserfs/xattr_trusted.c | |||
@@ -7,8 +7,6 @@ | |||
7 | #include <linux/reiserfs_xattr.h> | 7 | #include <linux/reiserfs_xattr.h> |
8 | #include <asm/uaccess.h> | 8 | #include <asm/uaccess.h> |
9 | 9 | ||
10 | #define XATTR_TRUSTED_PREFIX "trusted." | ||
11 | |||
12 | static int | 10 | static int |
13 | trusted_get(struct inode *inode, const char *name, void *buffer, size_t size) | 11 | trusted_get(struct inode *inode, const char *name, void *buffer, size_t size) |
14 | { | 12 | { |
diff --git a/fs/reiserfs/xattr_user.c b/fs/reiserfs/xattr_user.c index 073f39364b11..1384efcb938e 100644 --- a/fs/reiserfs/xattr_user.c +++ b/fs/reiserfs/xattr_user.c | |||
@@ -10,8 +10,6 @@ | |||
10 | # include <linux/reiserfs_acl.h> | 10 | # include <linux/reiserfs_acl.h> |
11 | #endif | 11 | #endif |
12 | 12 | ||
13 | #define XATTR_USER_PREFIX "user." | ||
14 | |||
15 | static int | 13 | static int |
16 | user_get(struct inode *inode, const char *name, void *buffer, size_t size) | 14 | user_get(struct inode *inode, const char *name, void *buffer, size_t size) |
17 | { | 15 | { |