diff options
Diffstat (limited to 'fs/ocfs2')
-rw-r--r-- | fs/ocfs2/Kconfig | 10 | ||||
-rw-r--r-- | fs/ocfs2/Makefile | 7 | ||||
-rw-r--r-- | fs/ocfs2/acl.c | 4 | ||||
-rw-r--r-- | fs/ocfs2/acl.h | 22 | ||||
-rw-r--r-- | fs/ocfs2/alloc.c | 10 | ||||
-rw-r--r-- | fs/ocfs2/alloc.h | 5 | ||||
-rw-r--r-- | fs/ocfs2/cluster/heartbeat.c | 6 | ||||
-rw-r--r-- | fs/ocfs2/cluster/nodemanager.c | 51 | ||||
-rw-r--r-- | fs/ocfs2/cluster/nodemanager.h | 7 | ||||
-rw-r--r-- | fs/ocfs2/cluster/quorum.c | 16 | ||||
-rw-r--r-- | fs/ocfs2/dlm/dlmrecovery.c | 18 | ||||
-rw-r--r-- | fs/ocfs2/extent_map.c | 25 | ||||
-rw-r--r-- | fs/ocfs2/namei.c | 6 | ||||
-rw-r--r-- | fs/ocfs2/ocfs2.h | 8 | ||||
-rw-r--r-- | fs/ocfs2/ocfs2_fs.h | 2 | ||||
-rw-r--r-- | fs/ocfs2/refcounttree.c | 150 | ||||
-rw-r--r-- | fs/ocfs2/stack_user.c | 2 | ||||
-rw-r--r-- | fs/ocfs2/super.c | 95 | ||||
-rw-r--r-- | fs/ocfs2/symlink.c | 2 | ||||
-rw-r--r-- | fs/ocfs2/xattr.c | 6 | ||||
-rw-r--r-- | fs/ocfs2/xattr.h | 2 |
21 files changed, 299 insertions, 155 deletions
diff --git a/fs/ocfs2/Kconfig b/fs/ocfs2/Kconfig index 701b7a3a872e..0d840669698e 100644 --- a/fs/ocfs2/Kconfig +++ b/fs/ocfs2/Kconfig | |||
@@ -6,6 +6,7 @@ config OCFS2_FS | |||
6 | select CRC32 | 6 | select CRC32 |
7 | select QUOTA | 7 | select QUOTA |
8 | select QUOTA_TREE | 8 | select QUOTA_TREE |
9 | select FS_POSIX_ACL | ||
9 | help | 10 | help |
10 | OCFS2 is a general purpose extent based shared disk cluster file | 11 | OCFS2 is a general purpose extent based shared disk cluster file |
11 | system with many similarities to ext3. It supports 64 bit inode | 12 | system with many similarities to ext3. It supports 64 bit inode |
@@ -74,12 +75,3 @@ config OCFS2_DEBUG_FS | |||
74 | This option will enable expensive consistency checks. Enable | 75 | This option will enable expensive consistency checks. Enable |
75 | this option for debugging only as it is likely to decrease | 76 | this option for debugging only as it is likely to decrease |
76 | performance of the filesystem. | 77 | performance of the filesystem. |
77 | |||
78 | config OCFS2_FS_POSIX_ACL | ||
79 | bool "OCFS2 POSIX Access Control Lists" | ||
80 | depends on OCFS2_FS | ||
81 | select FS_POSIX_ACL | ||
82 | default n | ||
83 | help | ||
84 | Posix Access Control Lists (ACLs) support permissions for users and | ||
85 | groups beyond the owner/group/world scheme. | ||
diff --git a/fs/ocfs2/Makefile b/fs/ocfs2/Makefile index 31f25ce32c97..600d2d2ade11 100644 --- a/fs/ocfs2/Makefile +++ b/fs/ocfs2/Makefile | |||
@@ -39,11 +39,8 @@ ocfs2-objs := \ | |||
39 | ver.o \ | 39 | ver.o \ |
40 | quota_local.o \ | 40 | quota_local.o \ |
41 | quota_global.o \ | 41 | quota_global.o \ |
42 | xattr.o | 42 | xattr.o \ |
43 | 43 | acl.o | |
44 | ifeq ($(CONFIG_OCFS2_FS_POSIX_ACL),y) | ||
45 | ocfs2-objs += acl.o | ||
46 | endif | ||
47 | 44 | ||
48 | ocfs2_stackglue-objs := stackglue.o | 45 | ocfs2_stackglue-objs := stackglue.o |
49 | ocfs2_stack_o2cb-objs := stack_o2cb.o | 46 | ocfs2_stack_o2cb-objs := stack_o2cb.o |
diff --git a/fs/ocfs2/acl.c b/fs/ocfs2/acl.c index e3e47415d851..0501974bedd0 100644 --- a/fs/ocfs2/acl.c +++ b/fs/ocfs2/acl.c | |||
@@ -98,15 +98,11 @@ static struct posix_acl *ocfs2_get_acl_nolock(struct inode *inode, | |||
98 | int type, | 98 | int type, |
99 | struct buffer_head *di_bh) | 99 | struct buffer_head *di_bh) |
100 | { | 100 | { |
101 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | ||
102 | int name_index; | 101 | int name_index; |
103 | char *value = NULL; | 102 | char *value = NULL; |
104 | struct posix_acl *acl; | 103 | struct posix_acl *acl; |
105 | int retval; | 104 | int retval; |
106 | 105 | ||
107 | if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL)) | ||
108 | return NULL; | ||
109 | |||
110 | switch (type) { | 106 | switch (type) { |
111 | case ACL_TYPE_ACCESS: | 107 | case ACL_TYPE_ACCESS: |
112 | name_index = OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS; | 108 | name_index = OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS; |
diff --git a/fs/ocfs2/acl.h b/fs/ocfs2/acl.h index 8f6389ed4da5..5c5d31f05853 100644 --- a/fs/ocfs2/acl.h +++ b/fs/ocfs2/acl.h | |||
@@ -26,8 +26,6 @@ struct ocfs2_acl_entry { | |||
26 | __le32 e_id; | 26 | __le32 e_id; |
27 | }; | 27 | }; |
28 | 28 | ||
29 | #ifdef CONFIG_OCFS2_FS_POSIX_ACL | ||
30 | |||
31 | extern int ocfs2_check_acl(struct inode *, int); | 29 | extern int ocfs2_check_acl(struct inode *, int); |
32 | extern int ocfs2_acl_chmod(struct inode *); | 30 | extern int ocfs2_acl_chmod(struct inode *); |
33 | extern int ocfs2_init_acl(handle_t *, struct inode *, struct inode *, | 31 | extern int ocfs2_init_acl(handle_t *, struct inode *, struct inode *, |
@@ -35,24 +33,4 @@ extern int ocfs2_init_acl(handle_t *, struct inode *, struct inode *, | |||
35 | struct ocfs2_alloc_context *, | 33 | struct ocfs2_alloc_context *, |
36 | struct ocfs2_alloc_context *); | 34 | struct ocfs2_alloc_context *); |
37 | 35 | ||
38 | #else /* CONFIG_OCFS2_FS_POSIX_ACL*/ | ||
39 | |||
40 | #define ocfs2_check_acl NULL | ||
41 | static inline int ocfs2_acl_chmod(struct inode *inode) | ||
42 | { | ||
43 | return 0; | ||
44 | } | ||
45 | static inline int ocfs2_init_acl(handle_t *handle, | ||
46 | struct inode *inode, | ||
47 | struct inode *dir, | ||
48 | struct buffer_head *di_bh, | ||
49 | struct buffer_head *dir_bh, | ||
50 | struct ocfs2_alloc_context *meta_ac, | ||
51 | struct ocfs2_alloc_context *data_ac) | ||
52 | { | ||
53 | return 0; | ||
54 | } | ||
55 | |||
56 | #endif /* CONFIG_OCFS2_FS_POSIX_ACL*/ | ||
57 | |||
58 | #endif /* OCFS2_ACL_H */ | 36 | #endif /* OCFS2_ACL_H */ |
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index fb4e672579b8..d17bdc718f74 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
@@ -1765,9 +1765,9 @@ set_and_inc: | |||
1765 | * | 1765 | * |
1766 | * The array index of the subtree root is passed back. | 1766 | * The array index of the subtree root is passed back. |
1767 | */ | 1767 | */ |
1768 | static int ocfs2_find_subtree_root(struct ocfs2_extent_tree *et, | 1768 | int ocfs2_find_subtree_root(struct ocfs2_extent_tree *et, |
1769 | struct ocfs2_path *left, | 1769 | struct ocfs2_path *left, |
1770 | struct ocfs2_path *right) | 1770 | struct ocfs2_path *right) |
1771 | { | 1771 | { |
1772 | int i = 0; | 1772 | int i = 0; |
1773 | 1773 | ||
@@ -2872,8 +2872,8 @@ out: | |||
2872 | * This looks similar, but is subtly different to | 2872 | * This looks similar, but is subtly different to |
2873 | * ocfs2_find_cpos_for_left_leaf(). | 2873 | * ocfs2_find_cpos_for_left_leaf(). |
2874 | */ | 2874 | */ |
2875 | static int ocfs2_find_cpos_for_right_leaf(struct super_block *sb, | 2875 | int ocfs2_find_cpos_for_right_leaf(struct super_block *sb, |
2876 | struct ocfs2_path *path, u32 *cpos) | 2876 | struct ocfs2_path *path, u32 *cpos) |
2877 | { | 2877 | { |
2878 | int i, j, ret = 0; | 2878 | int i, j, ret = 0; |
2879 | u64 blkno; | 2879 | u64 blkno; |
diff --git a/fs/ocfs2/alloc.h b/fs/ocfs2/alloc.h index 9c122d574464..1db4359ccb90 100644 --- a/fs/ocfs2/alloc.h +++ b/fs/ocfs2/alloc.h | |||
@@ -317,4 +317,9 @@ int ocfs2_path_bh_journal_access(handle_t *handle, | |||
317 | int ocfs2_journal_access_path(struct ocfs2_caching_info *ci, | 317 | int ocfs2_journal_access_path(struct ocfs2_caching_info *ci, |
318 | handle_t *handle, | 318 | handle_t *handle, |
319 | struct ocfs2_path *path); | 319 | struct ocfs2_path *path); |
320 | int ocfs2_find_cpos_for_right_leaf(struct super_block *sb, | ||
321 | struct ocfs2_path *path, u32 *cpos); | ||
322 | int ocfs2_find_subtree_root(struct ocfs2_extent_tree *et, | ||
323 | struct ocfs2_path *left, | ||
324 | struct ocfs2_path *right); | ||
320 | #endif /* OCFS2_ALLOC_H */ | 325 | #endif /* OCFS2_ALLOC_H */ |
diff --git a/fs/ocfs2/cluster/heartbeat.c b/fs/ocfs2/cluster/heartbeat.c index c452d116b892..eda5b8bcddd5 100644 --- a/fs/ocfs2/cluster/heartbeat.c +++ b/fs/ocfs2/cluster/heartbeat.c | |||
@@ -176,7 +176,8 @@ static void o2hb_write_timeout(struct work_struct *work) | |||
176 | 176 | ||
177 | static void o2hb_arm_write_timeout(struct o2hb_region *reg) | 177 | static void o2hb_arm_write_timeout(struct o2hb_region *reg) |
178 | { | 178 | { |
179 | mlog(0, "Queue write timeout for %u ms\n", O2HB_MAX_WRITE_TIMEOUT_MS); | 179 | mlog(ML_HEARTBEAT, "Queue write timeout for %u ms\n", |
180 | O2HB_MAX_WRITE_TIMEOUT_MS); | ||
180 | 181 | ||
181 | cancel_delayed_work(®->hr_write_timeout_work); | 182 | cancel_delayed_work(®->hr_write_timeout_work); |
182 | reg->hr_last_timeout_start = jiffies; | 183 | reg->hr_last_timeout_start = jiffies; |
@@ -874,7 +875,8 @@ static int o2hb_thread(void *data) | |||
874 | do_gettimeofday(&after_hb); | 875 | do_gettimeofday(&after_hb); |
875 | elapsed_msec = o2hb_elapsed_msecs(&before_hb, &after_hb); | 876 | elapsed_msec = o2hb_elapsed_msecs(&before_hb, &after_hb); |
876 | 877 | ||
877 | mlog(0, "start = %lu.%lu, end = %lu.%lu, msec = %u\n", | 878 | mlog(ML_HEARTBEAT, |
879 | "start = %lu.%lu, end = %lu.%lu, msec = %u\n", | ||
878 | before_hb.tv_sec, (unsigned long) before_hb.tv_usec, | 880 | before_hb.tv_sec, (unsigned long) before_hb.tv_usec, |
879 | after_hb.tv_sec, (unsigned long) after_hb.tv_usec, | 881 | after_hb.tv_sec, (unsigned long) after_hb.tv_usec, |
880 | elapsed_msec); | 882 | elapsed_msec); |
diff --git a/fs/ocfs2/cluster/nodemanager.c b/fs/ocfs2/cluster/nodemanager.c index 7ee6188bc79a..c81142e3ef84 100644 --- a/fs/ocfs2/cluster/nodemanager.c +++ b/fs/ocfs2/cluster/nodemanager.c | |||
@@ -35,6 +35,10 @@ | |||
35 | * cluster references throughout where nodes are looked up */ | 35 | * cluster references throughout where nodes are looked up */ |
36 | struct o2nm_cluster *o2nm_single_cluster = NULL; | 36 | struct o2nm_cluster *o2nm_single_cluster = NULL; |
37 | 37 | ||
38 | char *o2nm_fence_method_desc[O2NM_FENCE_METHODS] = { | ||
39 | "reset", /* O2NM_FENCE_RESET */ | ||
40 | "panic", /* O2NM_FENCE_PANIC */ | ||
41 | }; | ||
38 | 42 | ||
39 | struct o2nm_node *o2nm_get_node_by_num(u8 node_num) | 43 | struct o2nm_node *o2nm_get_node_by_num(u8 node_num) |
40 | { | 44 | { |
@@ -579,6 +583,43 @@ static ssize_t o2nm_cluster_attr_reconnect_delay_ms_write( | |||
579 | return o2nm_cluster_attr_write(page, count, | 583 | return o2nm_cluster_attr_write(page, count, |
580 | &cluster->cl_reconnect_delay_ms); | 584 | &cluster->cl_reconnect_delay_ms); |
581 | } | 585 | } |
586 | |||
587 | static ssize_t o2nm_cluster_attr_fence_method_read( | ||
588 | struct o2nm_cluster *cluster, char *page) | ||
589 | { | ||
590 | ssize_t ret = 0; | ||
591 | |||
592 | if (cluster) | ||
593 | ret = sprintf(page, "%s\n", | ||
594 | o2nm_fence_method_desc[cluster->cl_fence_method]); | ||
595 | return ret; | ||
596 | } | ||
597 | |||
598 | static ssize_t o2nm_cluster_attr_fence_method_write( | ||
599 | struct o2nm_cluster *cluster, const char *page, size_t count) | ||
600 | { | ||
601 | unsigned int i; | ||
602 | |||
603 | if (page[count - 1] != '\n') | ||
604 | goto bail; | ||
605 | |||
606 | for (i = 0; i < O2NM_FENCE_METHODS; ++i) { | ||
607 | if (count != strlen(o2nm_fence_method_desc[i]) + 1) | ||
608 | continue; | ||
609 | if (strncasecmp(page, o2nm_fence_method_desc[i], count - 1)) | ||
610 | continue; | ||
611 | if (cluster->cl_fence_method != i) { | ||
612 | printk(KERN_INFO "ocfs2: Changing fence method to %s\n", | ||
613 | o2nm_fence_method_desc[i]); | ||
614 | cluster->cl_fence_method = i; | ||
615 | } | ||
616 | return count; | ||
617 | } | ||
618 | |||
619 | bail: | ||
620 | return -EINVAL; | ||
621 | } | ||
622 | |||
582 | static struct o2nm_cluster_attribute o2nm_cluster_attr_idle_timeout_ms = { | 623 | static struct o2nm_cluster_attribute o2nm_cluster_attr_idle_timeout_ms = { |
583 | .attr = { .ca_owner = THIS_MODULE, | 624 | .attr = { .ca_owner = THIS_MODULE, |
584 | .ca_name = "idle_timeout_ms", | 625 | .ca_name = "idle_timeout_ms", |
@@ -603,10 +644,19 @@ static struct o2nm_cluster_attribute o2nm_cluster_attr_reconnect_delay_ms = { | |||
603 | .store = o2nm_cluster_attr_reconnect_delay_ms_write, | 644 | .store = o2nm_cluster_attr_reconnect_delay_ms_write, |
604 | }; | 645 | }; |
605 | 646 | ||
647 | static struct o2nm_cluster_attribute o2nm_cluster_attr_fence_method = { | ||
648 | .attr = { .ca_owner = THIS_MODULE, | ||
649 | .ca_name = "fence_method", | ||
650 | .ca_mode = S_IRUGO | S_IWUSR }, | ||
651 | .show = o2nm_cluster_attr_fence_method_read, | ||
652 | .store = o2nm_cluster_attr_fence_method_write, | ||
653 | }; | ||
654 | |||
606 | static struct configfs_attribute *o2nm_cluster_attrs[] = { | 655 | static struct configfs_attribute *o2nm_cluster_attrs[] = { |
607 | &o2nm_cluster_attr_idle_timeout_ms.attr, | 656 | &o2nm_cluster_attr_idle_timeout_ms.attr, |
608 | &o2nm_cluster_attr_keepalive_delay_ms.attr, | 657 | &o2nm_cluster_attr_keepalive_delay_ms.attr, |
609 | &o2nm_cluster_attr_reconnect_delay_ms.attr, | 658 | &o2nm_cluster_attr_reconnect_delay_ms.attr, |
659 | &o2nm_cluster_attr_fence_method.attr, | ||
610 | NULL, | 660 | NULL, |
611 | }; | 661 | }; |
612 | static ssize_t o2nm_cluster_show(struct config_item *item, | 662 | static ssize_t o2nm_cluster_show(struct config_item *item, |
@@ -778,6 +828,7 @@ static struct config_group *o2nm_cluster_group_make_group(struct config_group *g | |||
778 | cluster->cl_reconnect_delay_ms = O2NET_RECONNECT_DELAY_MS_DEFAULT; | 828 | cluster->cl_reconnect_delay_ms = O2NET_RECONNECT_DELAY_MS_DEFAULT; |
779 | cluster->cl_idle_timeout_ms = O2NET_IDLE_TIMEOUT_MS_DEFAULT; | 829 | cluster->cl_idle_timeout_ms = O2NET_IDLE_TIMEOUT_MS_DEFAULT; |
780 | cluster->cl_keepalive_delay_ms = O2NET_KEEPALIVE_DELAY_MS_DEFAULT; | 830 | cluster->cl_keepalive_delay_ms = O2NET_KEEPALIVE_DELAY_MS_DEFAULT; |
831 | cluster->cl_fence_method = O2NM_FENCE_RESET; | ||
781 | 832 | ||
782 | ret = &cluster->cl_group; | 833 | ret = &cluster->cl_group; |
783 | o2nm_single_cluster = cluster; | 834 | o2nm_single_cluster = cluster; |
diff --git a/fs/ocfs2/cluster/nodemanager.h b/fs/ocfs2/cluster/nodemanager.h index c992ea0da4ad..09ea2d388bbb 100644 --- a/fs/ocfs2/cluster/nodemanager.h +++ b/fs/ocfs2/cluster/nodemanager.h | |||
@@ -33,6 +33,12 @@ | |||
33 | #include <linux/configfs.h> | 33 | #include <linux/configfs.h> |
34 | #include <linux/rbtree.h> | 34 | #include <linux/rbtree.h> |
35 | 35 | ||
36 | enum o2nm_fence_method { | ||
37 | O2NM_FENCE_RESET = 0, | ||
38 | O2NM_FENCE_PANIC, | ||
39 | O2NM_FENCE_METHODS, /* Number of fence methods */ | ||
40 | }; | ||
41 | |||
36 | struct o2nm_node { | 42 | struct o2nm_node { |
37 | spinlock_t nd_lock; | 43 | spinlock_t nd_lock; |
38 | struct config_item nd_item; | 44 | struct config_item nd_item; |
@@ -58,6 +64,7 @@ struct o2nm_cluster { | |||
58 | unsigned int cl_idle_timeout_ms; | 64 | unsigned int cl_idle_timeout_ms; |
59 | unsigned int cl_keepalive_delay_ms; | 65 | unsigned int cl_keepalive_delay_ms; |
60 | unsigned int cl_reconnect_delay_ms; | 66 | unsigned int cl_reconnect_delay_ms; |
67 | enum o2nm_fence_method cl_fence_method; | ||
61 | 68 | ||
62 | /* this bitmap is part of a hack for disk bitmap.. will go eventually. - zab */ | 69 | /* this bitmap is part of a hack for disk bitmap.. will go eventually. - zab */ |
63 | unsigned long cl_nodes_bitmap[BITS_TO_LONGS(O2NM_MAX_NODES)]; | 70 | unsigned long cl_nodes_bitmap[BITS_TO_LONGS(O2NM_MAX_NODES)]; |
diff --git a/fs/ocfs2/cluster/quorum.c b/fs/ocfs2/cluster/quorum.c index bbacf7da48a4..639024033fce 100644 --- a/fs/ocfs2/cluster/quorum.c +++ b/fs/ocfs2/cluster/quorum.c | |||
@@ -74,8 +74,20 @@ static void o2quo_fence_self(void) | |||
74 | * threads can still schedule, etc, etc */ | 74 | * threads can still schedule, etc, etc */ |
75 | o2hb_stop_all_regions(); | 75 | o2hb_stop_all_regions(); |
76 | 76 | ||
77 | printk("ocfs2 is very sorry to be fencing this system by restarting\n"); | 77 | switch (o2nm_single_cluster->cl_fence_method) { |
78 | emergency_restart(); | 78 | case O2NM_FENCE_PANIC: |
79 | panic("*** ocfs2 is very sorry to be fencing this system by " | ||
80 | "panicing ***\n"); | ||
81 | break; | ||
82 | default: | ||
83 | WARN_ON(o2nm_single_cluster->cl_fence_method >= | ||
84 | O2NM_FENCE_METHODS); | ||
85 | case O2NM_FENCE_RESET: | ||
86 | printk(KERN_ERR "*** ocfs2 is very sorry to be fencing this " | ||
87 | "system by restarting ***\n"); | ||
88 | emergency_restart(); | ||
89 | break; | ||
90 | }; | ||
79 | } | 91 | } |
80 | 92 | ||
81 | /* Indicate that a timeout occured on a hearbeat region write. The | 93 | /* Indicate that a timeout occured on a hearbeat region write. The |
diff --git a/fs/ocfs2/dlm/dlmrecovery.c b/fs/ocfs2/dlm/dlmrecovery.c index d9fa3d22e17c..2f9e4e19a4f2 100644 --- a/fs/ocfs2/dlm/dlmrecovery.c +++ b/fs/ocfs2/dlm/dlmrecovery.c | |||
@@ -2589,6 +2589,14 @@ retry: | |||
2589 | "begin reco msg (%d)\n", dlm->name, nodenum, ret); | 2589 | "begin reco msg (%d)\n", dlm->name, nodenum, ret); |
2590 | ret = 0; | 2590 | ret = 0; |
2591 | } | 2591 | } |
2592 | if (ret == -EAGAIN) { | ||
2593 | mlog(0, "%s: trying to start recovery of node " | ||
2594 | "%u, but node %u is waiting for last recovery " | ||
2595 | "to complete, backoff for a bit\n", dlm->name, | ||
2596 | dead_node, nodenum); | ||
2597 | msleep(100); | ||
2598 | goto retry; | ||
2599 | } | ||
2592 | if (ret < 0) { | 2600 | if (ret < 0) { |
2593 | struct dlm_lock_resource *res; | 2601 | struct dlm_lock_resource *res; |
2594 | /* this is now a serious problem, possibly ENOMEM | 2602 | /* this is now a serious problem, possibly ENOMEM |
@@ -2608,14 +2616,6 @@ retry: | |||
2608 | * another ENOMEM */ | 2616 | * another ENOMEM */ |
2609 | msleep(100); | 2617 | msleep(100); |
2610 | goto retry; | 2618 | goto retry; |
2611 | } else if (ret == EAGAIN) { | ||
2612 | mlog(0, "%s: trying to start recovery of node " | ||
2613 | "%u, but node %u is waiting for last recovery " | ||
2614 | "to complete, backoff for a bit\n", dlm->name, | ||
2615 | dead_node, nodenum); | ||
2616 | /* TODO Look into replacing msleep with cond_resched() */ | ||
2617 | msleep(100); | ||
2618 | goto retry; | ||
2619 | } | 2619 | } |
2620 | } | 2620 | } |
2621 | 2621 | ||
@@ -2639,7 +2639,7 @@ int dlm_begin_reco_handler(struct o2net_msg *msg, u32 len, void *data, | |||
2639 | dlm->name, br->node_idx, br->dead_node, | 2639 | dlm->name, br->node_idx, br->dead_node, |
2640 | dlm->reco.dead_node, dlm->reco.new_master); | 2640 | dlm->reco.dead_node, dlm->reco.new_master); |
2641 | spin_unlock(&dlm->spinlock); | 2641 | spin_unlock(&dlm->spinlock); |
2642 | return EAGAIN; | 2642 | return -EAGAIN; |
2643 | } | 2643 | } |
2644 | spin_unlock(&dlm->spinlock); | 2644 | spin_unlock(&dlm->spinlock); |
2645 | 2645 | ||
diff --git a/fs/ocfs2/extent_map.c b/fs/ocfs2/extent_map.c index 843db64e9d4a..d35a27f4523e 100644 --- a/fs/ocfs2/extent_map.c +++ b/fs/ocfs2/extent_map.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include "extent_map.h" | 37 | #include "extent_map.h" |
38 | #include "inode.h" | 38 | #include "inode.h" |
39 | #include "super.h" | 39 | #include "super.h" |
40 | #include "symlink.h" | ||
40 | 41 | ||
41 | #include "buffer_head_io.h" | 42 | #include "buffer_head_io.h" |
42 | 43 | ||
@@ -703,6 +704,12 @@ out: | |||
703 | return ret; | 704 | return ret; |
704 | } | 705 | } |
705 | 706 | ||
707 | /* | ||
708 | * The ocfs2_fiemap_inline() may be a little bit misleading, since | ||
709 | * it not only handles the fiemap for inlined files, but also deals | ||
710 | * with the fast symlink, cause they have no difference for extent | ||
711 | * mapping per se. | ||
712 | */ | ||
706 | static int ocfs2_fiemap_inline(struct inode *inode, struct buffer_head *di_bh, | 713 | static int ocfs2_fiemap_inline(struct inode *inode, struct buffer_head *di_bh, |
707 | struct fiemap_extent_info *fieinfo, | 714 | struct fiemap_extent_info *fieinfo, |
708 | u64 map_start) | 715 | u64 map_start) |
@@ -715,11 +722,18 @@ static int ocfs2_fiemap_inline(struct inode *inode, struct buffer_head *di_bh, | |||
715 | struct ocfs2_inode_info *oi = OCFS2_I(inode); | 722 | struct ocfs2_inode_info *oi = OCFS2_I(inode); |
716 | 723 | ||
717 | di = (struct ocfs2_dinode *)di_bh->b_data; | 724 | di = (struct ocfs2_dinode *)di_bh->b_data; |
718 | id_count = le16_to_cpu(di->id2.i_data.id_count); | 725 | if (ocfs2_inode_is_fast_symlink(inode)) |
726 | id_count = ocfs2_fast_symlink_chars(inode->i_sb); | ||
727 | else | ||
728 | id_count = le16_to_cpu(di->id2.i_data.id_count); | ||
719 | 729 | ||
720 | if (map_start < id_count) { | 730 | if (map_start < id_count) { |
721 | phys = oi->ip_blkno << inode->i_sb->s_blocksize_bits; | 731 | phys = oi->ip_blkno << inode->i_sb->s_blocksize_bits; |
722 | phys += offsetof(struct ocfs2_dinode, id2.i_data.id_data); | 732 | if (ocfs2_inode_is_fast_symlink(inode)) |
733 | phys += offsetof(struct ocfs2_dinode, id2.i_symlink); | ||
734 | else | ||
735 | phys += offsetof(struct ocfs2_dinode, | ||
736 | id2.i_data.id_data); | ||
723 | 737 | ||
724 | ret = fiemap_fill_next_extent(fieinfo, 0, phys, id_count, | 738 | ret = fiemap_fill_next_extent(fieinfo, 0, phys, id_count, |
725 | flags); | 739 | flags); |
@@ -756,9 +770,10 @@ int ocfs2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | |||
756 | down_read(&OCFS2_I(inode)->ip_alloc_sem); | 770 | down_read(&OCFS2_I(inode)->ip_alloc_sem); |
757 | 771 | ||
758 | /* | 772 | /* |
759 | * Handle inline-data separately. | 773 | * Handle inline-data and fast symlink separately. |
760 | */ | 774 | */ |
761 | if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) { | 775 | if ((OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) || |
776 | ocfs2_inode_is_fast_symlink(inode)) { | ||
762 | ret = ocfs2_fiemap_inline(inode, di_bh, fieinfo, map_start); | 777 | ret = ocfs2_fiemap_inline(inode, di_bh, fieinfo, map_start); |
763 | goto out_unlock; | 778 | goto out_unlock; |
764 | } | 779 | } |
@@ -786,6 +801,8 @@ int ocfs2_fiemap(struct inode *inode, struct fiemap_extent_info *fieinfo, | |||
786 | fe_flags = 0; | 801 | fe_flags = 0; |
787 | if (rec.e_flags & OCFS2_EXT_UNWRITTEN) | 802 | if (rec.e_flags & OCFS2_EXT_UNWRITTEN) |
788 | fe_flags |= FIEMAP_EXTENT_UNWRITTEN; | 803 | fe_flags |= FIEMAP_EXTENT_UNWRITTEN; |
804 | if (rec.e_flags & OCFS2_EXT_REFCOUNTED) | ||
805 | fe_flags |= FIEMAP_EXTENT_SHARED; | ||
789 | if (is_last) | 806 | if (is_last) |
790 | fe_flags |= FIEMAP_EXTENT_LAST; | 807 | fe_flags |= FIEMAP_EXTENT_LAST; |
791 | len_bytes = (u64)le16_to_cpu(rec.e_leaf_clusters) << osb->s_clustersize_bits; | 808 | len_bytes = (u64)le16_to_cpu(rec.e_leaf_clusters) << osb->s_clustersize_bits; |
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c index f010b22b1c44..50fb26a6a5f5 100644 --- a/fs/ocfs2/namei.c +++ b/fs/ocfs2/namei.c | |||
@@ -2108,6 +2108,7 @@ int ocfs2_create_inode_in_orphan(struct inode *dir, | |||
2108 | } | 2108 | } |
2109 | did_quota_inode = 1; | 2109 | did_quota_inode = 1; |
2110 | 2110 | ||
2111 | inode->i_nlink = 0; | ||
2111 | /* do the real work now. */ | 2112 | /* do the real work now. */ |
2112 | status = ocfs2_mknod_locked(osb, dir, inode, | 2113 | status = ocfs2_mknod_locked(osb, dir, inode, |
2113 | 0, &new_di_bh, parent_di_bh, handle, | 2114 | 0, &new_di_bh, parent_di_bh, handle, |
@@ -2136,6 +2137,7 @@ int ocfs2_create_inode_in_orphan(struct inode *dir, | |||
2136 | if (status < 0) | 2137 | if (status < 0) |
2137 | mlog_errno(status); | 2138 | mlog_errno(status); |
2138 | 2139 | ||
2140 | insert_inode_hash(inode); | ||
2139 | leave: | 2141 | leave: |
2140 | if (status < 0 && did_quota_inode) | 2142 | if (status < 0 && did_quota_inode) |
2141 | vfs_dq_free_inode(inode); | 2143 | vfs_dq_free_inode(inode); |
@@ -2267,6 +2269,8 @@ int ocfs2_mv_orphaned_inode_to_new(struct inode *dir, | |||
2267 | di = (struct ocfs2_dinode *)di_bh->b_data; | 2269 | di = (struct ocfs2_dinode *)di_bh->b_data; |
2268 | le32_add_cpu(&di->i_flags, -OCFS2_ORPHANED_FL); | 2270 | le32_add_cpu(&di->i_flags, -OCFS2_ORPHANED_FL); |
2269 | di->i_orphaned_slot = 0; | 2271 | di->i_orphaned_slot = 0; |
2272 | inode->i_nlink = 1; | ||
2273 | ocfs2_set_links_count(di, inode->i_nlink); | ||
2270 | ocfs2_journal_dirty(handle, di_bh); | 2274 | ocfs2_journal_dirty(handle, di_bh); |
2271 | 2275 | ||
2272 | status = ocfs2_add_entry(handle, dentry, inode, | 2276 | status = ocfs2_add_entry(handle, dentry, inode, |
@@ -2284,7 +2288,6 @@ int ocfs2_mv_orphaned_inode_to_new(struct inode *dir, | |||
2284 | goto out_commit; | 2288 | goto out_commit; |
2285 | } | 2289 | } |
2286 | 2290 | ||
2287 | insert_inode_hash(inode); | ||
2288 | dentry->d_op = &ocfs2_dentry_ops; | 2291 | dentry->d_op = &ocfs2_dentry_ops; |
2289 | d_instantiate(dentry, inode); | 2292 | d_instantiate(dentry, inode); |
2290 | status = 0; | 2293 | status = 0; |
@@ -2326,4 +2329,5 @@ const struct inode_operations ocfs2_dir_iops = { | |||
2326 | .getxattr = generic_getxattr, | 2329 | .getxattr = generic_getxattr, |
2327 | .listxattr = ocfs2_listxattr, | 2330 | .listxattr = ocfs2_listxattr, |
2328 | .removexattr = generic_removexattr, | 2331 | .removexattr = generic_removexattr, |
2332 | .fiemap = ocfs2_fiemap, | ||
2329 | }; | 2333 | }; |
diff --git a/fs/ocfs2/ocfs2.h b/fs/ocfs2/ocfs2.h index d963d8638709..9362eea7424b 100644 --- a/fs/ocfs2/ocfs2.h +++ b/fs/ocfs2/ocfs2.h | |||
@@ -245,9 +245,11 @@ enum ocfs2_mount_options | |||
245 | OCFS2_MOUNT_LOCALFLOCKS = 1 << 5, /* No cluster aware user file locks */ | 245 | OCFS2_MOUNT_LOCALFLOCKS = 1 << 5, /* No cluster aware user file locks */ |
246 | OCFS2_MOUNT_NOUSERXATTR = 1 << 6, /* No user xattr */ | 246 | OCFS2_MOUNT_NOUSERXATTR = 1 << 6, /* No user xattr */ |
247 | OCFS2_MOUNT_INODE64 = 1 << 7, /* Allow inode numbers > 2^32 */ | 247 | OCFS2_MOUNT_INODE64 = 1 << 7, /* Allow inode numbers > 2^32 */ |
248 | OCFS2_MOUNT_POSIX_ACL = 1 << 8, /* POSIX access control lists */ | 248 | OCFS2_MOUNT_POSIX_ACL = 1 << 8, /* Force POSIX access control lists */ |
249 | OCFS2_MOUNT_USRQUOTA = 1 << 9, /* We support user quotas */ | 249 | OCFS2_MOUNT_NO_POSIX_ACL = 1 << 9, /* Disable POSIX access |
250 | OCFS2_MOUNT_GRPQUOTA = 1 << 10, /* We support group quotas */ | 250 | control lists */ |
251 | OCFS2_MOUNT_USRQUOTA = 1 << 10, /* We support user quotas */ | ||
252 | OCFS2_MOUNT_GRPQUOTA = 1 << 11, /* We support group quotas */ | ||
251 | }; | 253 | }; |
252 | 254 | ||
253 | #define OCFS2_OSB_SOFT_RO 0x0001 | 255 | #define OCFS2_OSB_SOFT_RO 0x0001 |
diff --git a/fs/ocfs2/ocfs2_fs.h b/fs/ocfs2/ocfs2_fs.h index e9431e4a5e7c..1a1a679e51b5 100644 --- a/fs/ocfs2/ocfs2_fs.h +++ b/fs/ocfs2/ocfs2_fs.h | |||
@@ -1202,7 +1202,7 @@ struct ocfs2_local_disk_dqinfo { | |||
1202 | /* Header of one chunk of a quota file */ | 1202 | /* Header of one chunk of a quota file */ |
1203 | struct ocfs2_local_disk_chunk { | 1203 | struct ocfs2_local_disk_chunk { |
1204 | __le32 dqc_free; /* Number of free entries in the bitmap */ | 1204 | __le32 dqc_free; /* Number of free entries in the bitmap */ |
1205 | u8 dqc_bitmap[0]; /* Bitmap of entries in the corresponding | 1205 | __u8 dqc_bitmap[0]; /* Bitmap of entries in the corresponding |
1206 | * chunk of quota file */ | 1206 | * chunk of quota file */ |
1207 | }; | 1207 | }; |
1208 | 1208 | ||
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c index 30967e3f5e43..74db2be75dd6 100644 --- a/fs/ocfs2/refcounttree.c +++ b/fs/ocfs2/refcounttree.c | |||
@@ -276,7 +276,7 @@ static void ocfs2_erase_refcount_tree_from_list(struct ocfs2_super *osb, | |||
276 | spin_unlock(&osb->osb_lock); | 276 | spin_unlock(&osb->osb_lock); |
277 | } | 277 | } |
278 | 278 | ||
279 | void ocfs2_kref_remove_refcount_tree(struct kref *kref) | 279 | static void ocfs2_kref_remove_refcount_tree(struct kref *kref) |
280 | { | 280 | { |
281 | struct ocfs2_refcount_tree *tree = | 281 | struct ocfs2_refcount_tree *tree = |
282 | container_of(kref, struct ocfs2_refcount_tree, rf_getcnt); | 282 | container_of(kref, struct ocfs2_refcount_tree, rf_getcnt); |
@@ -524,23 +524,6 @@ out: | |||
524 | return ret; | 524 | return ret; |
525 | } | 525 | } |
526 | 526 | ||
527 | int ocfs2_lock_refcount_tree_by_inode(struct inode *inode, int rw, | ||
528 | struct ocfs2_refcount_tree **ret_tree, | ||
529 | struct buffer_head **ref_bh) | ||
530 | { | ||
531 | int ret; | ||
532 | u64 ref_blkno; | ||
533 | |||
534 | ret = ocfs2_get_refcount_block(inode, &ref_blkno); | ||
535 | if (ret) { | ||
536 | mlog_errno(ret); | ||
537 | return ret; | ||
538 | } | ||
539 | |||
540 | return ocfs2_lock_refcount_tree(OCFS2_SB(inode->i_sb), ref_blkno, | ||
541 | rw, ret_tree, ref_bh); | ||
542 | } | ||
543 | |||
544 | void ocfs2_unlock_refcount_tree(struct ocfs2_super *osb, | 527 | void ocfs2_unlock_refcount_tree(struct ocfs2_super *osb, |
545 | struct ocfs2_refcount_tree *tree, int rw) | 528 | struct ocfs2_refcount_tree *tree, int rw) |
546 | { | 529 | { |
@@ -969,6 +952,103 @@ out: | |||
969 | } | 952 | } |
970 | 953 | ||
971 | /* | 954 | /* |
955 | * Find the end range for a leaf refcount block indicated by | ||
956 | * el->l_recs[index].e_blkno. | ||
957 | */ | ||
958 | static int ocfs2_get_refcount_cpos_end(struct ocfs2_caching_info *ci, | ||
959 | struct buffer_head *ref_root_bh, | ||
960 | struct ocfs2_extent_block *eb, | ||
961 | struct ocfs2_extent_list *el, | ||
962 | int index, u32 *cpos_end) | ||
963 | { | ||
964 | int ret, i, subtree_root; | ||
965 | u32 cpos; | ||
966 | u64 blkno; | ||
967 | struct super_block *sb = ocfs2_metadata_cache_get_super(ci); | ||
968 | struct ocfs2_path *left_path = NULL, *right_path = NULL; | ||
969 | struct ocfs2_extent_tree et; | ||
970 | struct ocfs2_extent_list *tmp_el; | ||
971 | |||
972 | if (index < le16_to_cpu(el->l_next_free_rec) - 1) { | ||
973 | /* | ||
974 | * We have a extent rec after index, so just use the e_cpos | ||
975 | * of the next extent rec. | ||
976 | */ | ||
977 | *cpos_end = le32_to_cpu(el->l_recs[index+1].e_cpos); | ||
978 | return 0; | ||
979 | } | ||
980 | |||
981 | if (!eb || (eb && !eb->h_next_leaf_blk)) { | ||
982 | /* | ||
983 | * We are the last extent rec, so any high cpos should | ||
984 | * be stored in this leaf refcount block. | ||
985 | */ | ||
986 | *cpos_end = UINT_MAX; | ||
987 | return 0; | ||
988 | } | ||
989 | |||
990 | /* | ||
991 | * If the extent block isn't the last one, we have to find | ||
992 | * the subtree root between this extent block and the next | ||
993 | * leaf extent block and get the corresponding e_cpos from | ||
994 | * the subroot. Otherwise we may corrupt the b-tree. | ||
995 | */ | ||
996 | ocfs2_init_refcount_extent_tree(&et, ci, ref_root_bh); | ||
997 | |||
998 | left_path = ocfs2_new_path_from_et(&et); | ||
999 | if (!left_path) { | ||
1000 | ret = -ENOMEM; | ||
1001 | mlog_errno(ret); | ||
1002 | goto out; | ||
1003 | } | ||
1004 | |||
1005 | cpos = le32_to_cpu(eb->h_list.l_recs[index].e_cpos); | ||
1006 | ret = ocfs2_find_path(ci, left_path, cpos); | ||
1007 | if (ret) { | ||
1008 | mlog_errno(ret); | ||
1009 | goto out; | ||
1010 | } | ||
1011 | |||
1012 | right_path = ocfs2_new_path_from_path(left_path); | ||
1013 | if (!right_path) { | ||
1014 | ret = -ENOMEM; | ||
1015 | mlog_errno(ret); | ||
1016 | goto out; | ||
1017 | } | ||
1018 | |||
1019 | ret = ocfs2_find_cpos_for_right_leaf(sb, left_path, &cpos); | ||
1020 | if (ret) { | ||
1021 | mlog_errno(ret); | ||
1022 | goto out; | ||
1023 | } | ||
1024 | |||
1025 | ret = ocfs2_find_path(ci, right_path, cpos); | ||
1026 | if (ret) { | ||
1027 | mlog_errno(ret); | ||
1028 | goto out; | ||
1029 | } | ||
1030 | |||
1031 | subtree_root = ocfs2_find_subtree_root(&et, left_path, | ||
1032 | right_path); | ||
1033 | |||
1034 | tmp_el = left_path->p_node[subtree_root].el; | ||
1035 | blkno = left_path->p_node[subtree_root+1].bh->b_blocknr; | ||
1036 | for (i = 0; i < le32_to_cpu(tmp_el->l_next_free_rec); i++) { | ||
1037 | if (le64_to_cpu(tmp_el->l_recs[i].e_blkno) == blkno) { | ||
1038 | *cpos_end = le32_to_cpu(tmp_el->l_recs[i+1].e_cpos); | ||
1039 | break; | ||
1040 | } | ||
1041 | } | ||
1042 | |||
1043 | BUG_ON(i == le32_to_cpu(tmp_el->l_next_free_rec)); | ||
1044 | |||
1045 | out: | ||
1046 | ocfs2_free_path(left_path); | ||
1047 | ocfs2_free_path(right_path); | ||
1048 | return ret; | ||
1049 | } | ||
1050 | |||
1051 | /* | ||
972 | * Given a cpos and len, try to find the refcount record which contains cpos. | 1052 | * Given a cpos and len, try to find the refcount record which contains cpos. |
973 | * 1. If cpos can be found in one refcount record, return the record. | 1053 | * 1. If cpos can be found in one refcount record, return the record. |
974 | * 2. If cpos can't be found, return a fake record which start from cpos | 1054 | * 2. If cpos can't be found, return a fake record which start from cpos |
@@ -983,10 +1063,10 @@ static int ocfs2_get_refcount_rec(struct ocfs2_caching_info *ci, | |||
983 | struct buffer_head **ret_bh) | 1063 | struct buffer_head **ret_bh) |
984 | { | 1064 | { |
985 | int ret = 0, i, found; | 1065 | int ret = 0, i, found; |
986 | u32 low_cpos; | 1066 | u32 low_cpos, uninitialized_var(cpos_end); |
987 | struct ocfs2_extent_list *el; | 1067 | struct ocfs2_extent_list *el; |
988 | struct ocfs2_extent_rec *tmp, *rec = NULL; | 1068 | struct ocfs2_extent_rec *rec = NULL; |
989 | struct ocfs2_extent_block *eb; | 1069 | struct ocfs2_extent_block *eb = NULL; |
990 | struct buffer_head *eb_bh = NULL, *ref_leaf_bh = NULL; | 1070 | struct buffer_head *eb_bh = NULL, *ref_leaf_bh = NULL; |
991 | struct super_block *sb = ocfs2_metadata_cache_get_super(ci); | 1071 | struct super_block *sb = ocfs2_metadata_cache_get_super(ci); |
992 | struct ocfs2_refcount_block *rb = | 1072 | struct ocfs2_refcount_block *rb = |
@@ -1034,12 +1114,16 @@ static int ocfs2_get_refcount_rec(struct ocfs2_caching_info *ci, | |||
1034 | } | 1114 | } |
1035 | } | 1115 | } |
1036 | 1116 | ||
1037 | /* adjust len when we have ocfs2_extent_rec after it. */ | 1117 | if (found) { |
1038 | if (found && i < le16_to_cpu(el->l_next_free_rec) - 1) { | 1118 | ret = ocfs2_get_refcount_cpos_end(ci, ref_root_bh, |
1039 | tmp = &el->l_recs[i+1]; | 1119 | eb, el, i, &cpos_end); |
1120 | if (ret) { | ||
1121 | mlog_errno(ret); | ||
1122 | goto out; | ||
1123 | } | ||
1040 | 1124 | ||
1041 | if (le32_to_cpu(tmp->e_cpos) < cpos + len) | 1125 | if (cpos_end < low_cpos + len) |
1042 | len = le32_to_cpu(tmp->e_cpos) - cpos; | 1126 | len = cpos_end - low_cpos; |
1043 | } | 1127 | } |
1044 | 1128 | ||
1045 | ret = ocfs2_read_refcount_block(ci, le64_to_cpu(rec->e_blkno), | 1129 | ret = ocfs2_read_refcount_block(ci, le64_to_cpu(rec->e_blkno), |
@@ -1418,7 +1502,7 @@ static int ocfs2_divide_leaf_refcount_block(struct buffer_head *ref_leaf_bh, | |||
1418 | 1502 | ||
1419 | /* change old and new rl_used accordingly. */ | 1503 | /* change old and new rl_used accordingly. */ |
1420 | le16_add_cpu(&rl->rl_used, -num_moved); | 1504 | le16_add_cpu(&rl->rl_used, -num_moved); |
1421 | new_rl->rl_used = cpu_to_le32(num_moved); | 1505 | new_rl->rl_used = cpu_to_le16(num_moved); |
1422 | 1506 | ||
1423 | sort(&rl->rl_recs, le16_to_cpu(rl->rl_used), | 1507 | sort(&rl->rl_recs, le16_to_cpu(rl->rl_used), |
1424 | sizeof(struct ocfs2_refcount_rec), | 1508 | sizeof(struct ocfs2_refcount_rec), |
@@ -1797,7 +1881,8 @@ static int ocfs2_split_refcount_rec(handle_t *handle, | |||
1797 | recs_need++; | 1881 | recs_need++; |
1798 | 1882 | ||
1799 | /* If the leaf block don't have enough record, expand it. */ | 1883 | /* If the leaf block don't have enough record, expand it. */ |
1800 | if (le16_to_cpu(rf_list->rl_used) + recs_need > rf_list->rl_count) { | 1884 | if (le16_to_cpu(rf_list->rl_used) + recs_need > |
1885 | le16_to_cpu(rf_list->rl_count)) { | ||
1801 | struct ocfs2_refcount_rec tmp_rec; | 1886 | struct ocfs2_refcount_rec tmp_rec; |
1802 | u64 cpos = le64_to_cpu(orig_rec->r_cpos); | 1887 | u64 cpos = le64_to_cpu(orig_rec->r_cpos); |
1803 | len = le32_to_cpu(orig_rec->r_clusters); | 1888 | len = le32_to_cpu(orig_rec->r_clusters); |
@@ -1859,7 +1944,7 @@ static int ocfs2_split_refcount_rec(handle_t *handle, | |||
1859 | memcpy(tail_rec, orig_rec, sizeof(struct ocfs2_refcount_rec)); | 1944 | memcpy(tail_rec, orig_rec, sizeof(struct ocfs2_refcount_rec)); |
1860 | le64_add_cpu(&tail_rec->r_cpos, | 1945 | le64_add_cpu(&tail_rec->r_cpos, |
1861 | le32_to_cpu(tail_rec->r_clusters) - len); | 1946 | le32_to_cpu(tail_rec->r_clusters) - len); |
1862 | tail_rec->r_clusters = le32_to_cpu(len); | 1947 | tail_rec->r_clusters = cpu_to_le32(len); |
1863 | } | 1948 | } |
1864 | 1949 | ||
1865 | /* | 1950 | /* |
@@ -3840,8 +3925,7 @@ static int ocfs2_add_refcounted_extent(struct inode *inode, | |||
3840 | } | 3925 | } |
3841 | 3926 | ||
3842 | ret = ocfs2_insert_extent(handle, et, cpos, | 3927 | ret = ocfs2_insert_extent(handle, et, cpos, |
3843 | cpu_to_le64(ocfs2_clusters_to_blocks(inode->i_sb, | 3928 | ocfs2_clusters_to_blocks(inode->i_sb, p_cluster), |
3844 | p_cluster)), | ||
3845 | num_clusters, ext_flags, meta_ac); | 3929 | num_clusters, ext_flags, meta_ac); |
3846 | if (ret) { | 3930 | if (ret) { |
3847 | mlog_errno(ret); | 3931 | mlog_errno(ret); |
@@ -4253,8 +4337,8 @@ static int ocfs2_user_path_parent(const char __user *path, | |||
4253 | * @new_dentry: target dentry | 4337 | * @new_dentry: target dentry |
4254 | * @preserve: if true, preserve all file attributes | 4338 | * @preserve: if true, preserve all file attributes |
4255 | */ | 4339 | */ |
4256 | int ocfs2_vfs_reflink(struct dentry *old_dentry, struct inode *dir, | 4340 | static int ocfs2_vfs_reflink(struct dentry *old_dentry, struct inode *dir, |
4257 | struct dentry *new_dentry, bool preserve) | 4341 | struct dentry *new_dentry, bool preserve) |
4258 | { | 4342 | { |
4259 | struct inode *inode = old_dentry->d_inode; | 4343 | struct inode *inode = old_dentry->d_inode; |
4260 | int error; | 4344 | int error; |
diff --git a/fs/ocfs2/stack_user.c b/fs/ocfs2/stack_user.c index ff4c798a5635..da78a2a334fd 100644 --- a/fs/ocfs2/stack_user.c +++ b/fs/ocfs2/stack_user.c | |||
@@ -814,7 +814,7 @@ static int fs_protocol_compare(struct ocfs2_protocol_version *existing, | |||
814 | static int user_cluster_connect(struct ocfs2_cluster_connection *conn) | 814 | static int user_cluster_connect(struct ocfs2_cluster_connection *conn) |
815 | { | 815 | { |
816 | dlm_lockspace_t *fsdlm; | 816 | dlm_lockspace_t *fsdlm; |
817 | struct ocfs2_live_connection *control; | 817 | struct ocfs2_live_connection *uninitialized_var(control); |
818 | int rc = 0; | 818 | int rc = 0; |
819 | 819 | ||
820 | BUG_ON(conn == NULL); | 820 | BUG_ON(conn == NULL); |
diff --git a/fs/ocfs2/super.c b/fs/ocfs2/super.c index 14f47d2bfe02..26069917a9f5 100644 --- a/fs/ocfs2/super.c +++ b/fs/ocfs2/super.c | |||
@@ -100,6 +100,8 @@ struct mount_options | |||
100 | static int ocfs2_parse_options(struct super_block *sb, char *options, | 100 | static int ocfs2_parse_options(struct super_block *sb, char *options, |
101 | struct mount_options *mopt, | 101 | struct mount_options *mopt, |
102 | int is_remount); | 102 | int is_remount); |
103 | static int ocfs2_check_set_options(struct super_block *sb, | ||
104 | struct mount_options *options); | ||
103 | static int ocfs2_show_options(struct seq_file *s, struct vfsmount *mnt); | 105 | static int ocfs2_show_options(struct seq_file *s, struct vfsmount *mnt); |
104 | static void ocfs2_put_super(struct super_block *sb); | 106 | static void ocfs2_put_super(struct super_block *sb); |
105 | static int ocfs2_mount_volume(struct super_block *sb); | 107 | static int ocfs2_mount_volume(struct super_block *sb); |
@@ -600,7 +602,8 @@ static int ocfs2_remount(struct super_block *sb, int *flags, char *data) | |||
600 | 602 | ||
601 | lock_kernel(); | 603 | lock_kernel(); |
602 | 604 | ||
603 | if (!ocfs2_parse_options(sb, data, &parsed_options, 1)) { | 605 | if (!ocfs2_parse_options(sb, data, &parsed_options, 1) || |
606 | !ocfs2_check_set_options(sb, &parsed_options)) { | ||
604 | ret = -EINVAL; | 607 | ret = -EINVAL; |
605 | goto out; | 608 | goto out; |
606 | } | 609 | } |
@@ -691,8 +694,6 @@ unlock_osb: | |||
691 | if (!ret) { | 694 | if (!ret) { |
692 | /* Only save off the new mount options in case of a successful | 695 | /* Only save off the new mount options in case of a successful |
693 | * remount. */ | 696 | * remount. */ |
694 | if (!(osb->s_feature_incompat & OCFS2_FEATURE_INCOMPAT_XATTR)) | ||
695 | parsed_options.mount_opt &= ~OCFS2_MOUNT_POSIX_ACL; | ||
696 | osb->s_mount_opt = parsed_options.mount_opt; | 697 | osb->s_mount_opt = parsed_options.mount_opt; |
697 | osb->s_atime_quantum = parsed_options.atime_quantum; | 698 | osb->s_atime_quantum = parsed_options.atime_quantum; |
698 | osb->preferred_slot = parsed_options.slot; | 699 | osb->preferred_slot = parsed_options.slot; |
@@ -701,6 +702,10 @@ unlock_osb: | |||
701 | 702 | ||
702 | if (!ocfs2_is_hard_readonly(osb)) | 703 | if (!ocfs2_is_hard_readonly(osb)) |
703 | ocfs2_set_journal_params(osb); | 704 | ocfs2_set_journal_params(osb); |
705 | |||
706 | sb->s_flags = (sb->s_flags & ~MS_POSIXACL) | | ||
707 | ((osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL) ? | ||
708 | MS_POSIXACL : 0); | ||
704 | } | 709 | } |
705 | out: | 710 | out: |
706 | unlock_kernel(); | 711 | unlock_kernel(); |
@@ -1011,31 +1016,16 @@ static int ocfs2_fill_super(struct super_block *sb, void *data, int silent) | |||
1011 | brelse(bh); | 1016 | brelse(bh); |
1012 | bh = NULL; | 1017 | bh = NULL; |
1013 | 1018 | ||
1014 | if (!(osb->s_feature_incompat & OCFS2_FEATURE_INCOMPAT_XATTR)) | 1019 | if (!ocfs2_check_set_options(sb, &parsed_options)) { |
1015 | parsed_options.mount_opt &= ~OCFS2_MOUNT_POSIX_ACL; | 1020 | status = -EINVAL; |
1016 | 1021 | goto read_super_error; | |
1022 | } | ||
1017 | osb->s_mount_opt = parsed_options.mount_opt; | 1023 | osb->s_mount_opt = parsed_options.mount_opt; |
1018 | osb->s_atime_quantum = parsed_options.atime_quantum; | 1024 | osb->s_atime_quantum = parsed_options.atime_quantum; |
1019 | osb->preferred_slot = parsed_options.slot; | 1025 | osb->preferred_slot = parsed_options.slot; |
1020 | osb->osb_commit_interval = parsed_options.commit_interval; | 1026 | osb->osb_commit_interval = parsed_options.commit_interval; |
1021 | osb->local_alloc_default_bits = ocfs2_megabytes_to_clusters(sb, parsed_options.localalloc_opt); | 1027 | osb->local_alloc_default_bits = ocfs2_megabytes_to_clusters(sb, parsed_options.localalloc_opt); |
1022 | osb->local_alloc_bits = osb->local_alloc_default_bits; | 1028 | osb->local_alloc_bits = osb->local_alloc_default_bits; |
1023 | if (osb->s_mount_opt & OCFS2_MOUNT_USRQUOTA && | ||
1024 | !OCFS2_HAS_RO_COMPAT_FEATURE(sb, | ||
1025 | OCFS2_FEATURE_RO_COMPAT_USRQUOTA)) { | ||
1026 | status = -EINVAL; | ||
1027 | mlog(ML_ERROR, "User quotas were requested, but this " | ||
1028 | "filesystem does not have the feature enabled.\n"); | ||
1029 | goto read_super_error; | ||
1030 | } | ||
1031 | if (osb->s_mount_opt & OCFS2_MOUNT_GRPQUOTA && | ||
1032 | !OCFS2_HAS_RO_COMPAT_FEATURE(sb, | ||
1033 | OCFS2_FEATURE_RO_COMPAT_GRPQUOTA)) { | ||
1034 | status = -EINVAL; | ||
1035 | mlog(ML_ERROR, "Group quotas were requested, but this " | ||
1036 | "filesystem does not have the feature enabled.\n"); | ||
1037 | goto read_super_error; | ||
1038 | } | ||
1039 | 1029 | ||
1040 | status = ocfs2_verify_userspace_stack(osb, &parsed_options); | 1030 | status = ocfs2_verify_userspace_stack(osb, &parsed_options); |
1041 | if (status) | 1031 | if (status) |
@@ -1245,6 +1235,40 @@ static struct file_system_type ocfs2_fs_type = { | |||
1245 | .next = NULL | 1235 | .next = NULL |
1246 | }; | 1236 | }; |
1247 | 1237 | ||
1238 | static int ocfs2_check_set_options(struct super_block *sb, | ||
1239 | struct mount_options *options) | ||
1240 | { | ||
1241 | if (options->mount_opt & OCFS2_MOUNT_USRQUOTA && | ||
1242 | !OCFS2_HAS_RO_COMPAT_FEATURE(sb, | ||
1243 | OCFS2_FEATURE_RO_COMPAT_USRQUOTA)) { | ||
1244 | mlog(ML_ERROR, "User quotas were requested, but this " | ||
1245 | "filesystem does not have the feature enabled.\n"); | ||
1246 | return 0; | ||
1247 | } | ||
1248 | if (options->mount_opt & OCFS2_MOUNT_GRPQUOTA && | ||
1249 | !OCFS2_HAS_RO_COMPAT_FEATURE(sb, | ||
1250 | OCFS2_FEATURE_RO_COMPAT_GRPQUOTA)) { | ||
1251 | mlog(ML_ERROR, "Group quotas were requested, but this " | ||
1252 | "filesystem does not have the feature enabled.\n"); | ||
1253 | return 0; | ||
1254 | } | ||
1255 | if (options->mount_opt & OCFS2_MOUNT_POSIX_ACL && | ||
1256 | !OCFS2_HAS_INCOMPAT_FEATURE(sb, OCFS2_FEATURE_INCOMPAT_XATTR)) { | ||
1257 | mlog(ML_ERROR, "ACL support requested but extended attributes " | ||
1258 | "feature is not enabled\n"); | ||
1259 | return 0; | ||
1260 | } | ||
1261 | /* No ACL setting specified? Use XATTR feature... */ | ||
1262 | if (!(options->mount_opt & (OCFS2_MOUNT_POSIX_ACL | | ||
1263 | OCFS2_MOUNT_NO_POSIX_ACL))) { | ||
1264 | if (OCFS2_HAS_INCOMPAT_FEATURE(sb, OCFS2_FEATURE_INCOMPAT_XATTR)) | ||
1265 | options->mount_opt |= OCFS2_MOUNT_POSIX_ACL; | ||
1266 | else | ||
1267 | options->mount_opt |= OCFS2_MOUNT_NO_POSIX_ACL; | ||
1268 | } | ||
1269 | return 1; | ||
1270 | } | ||
1271 | |||
1248 | static int ocfs2_parse_options(struct super_block *sb, | 1272 | static int ocfs2_parse_options(struct super_block *sb, |
1249 | char *options, | 1273 | char *options, |
1250 | struct mount_options *mopt, | 1274 | struct mount_options *mopt, |
@@ -1392,40 +1416,19 @@ static int ocfs2_parse_options(struct super_block *sb, | |||
1392 | mopt->mount_opt |= OCFS2_MOUNT_INODE64; | 1416 | mopt->mount_opt |= OCFS2_MOUNT_INODE64; |
1393 | break; | 1417 | break; |
1394 | case Opt_usrquota: | 1418 | case Opt_usrquota: |
1395 | /* We check only on remount, otherwise features | ||
1396 | * aren't yet initialized. */ | ||
1397 | if (is_remount && !OCFS2_HAS_RO_COMPAT_FEATURE(sb, | ||
1398 | OCFS2_FEATURE_RO_COMPAT_USRQUOTA)) { | ||
1399 | mlog(ML_ERROR, "User quota requested but " | ||
1400 | "filesystem feature is not set\n"); | ||
1401 | status = 0; | ||
1402 | goto bail; | ||
1403 | } | ||
1404 | mopt->mount_opt |= OCFS2_MOUNT_USRQUOTA; | 1419 | mopt->mount_opt |= OCFS2_MOUNT_USRQUOTA; |
1405 | break; | 1420 | break; |
1406 | case Opt_grpquota: | 1421 | case Opt_grpquota: |
1407 | if (is_remount && !OCFS2_HAS_RO_COMPAT_FEATURE(sb, | ||
1408 | OCFS2_FEATURE_RO_COMPAT_GRPQUOTA)) { | ||
1409 | mlog(ML_ERROR, "Group quota requested but " | ||
1410 | "filesystem feature is not set\n"); | ||
1411 | status = 0; | ||
1412 | goto bail; | ||
1413 | } | ||
1414 | mopt->mount_opt |= OCFS2_MOUNT_GRPQUOTA; | 1422 | mopt->mount_opt |= OCFS2_MOUNT_GRPQUOTA; |
1415 | break; | 1423 | break; |
1416 | #ifdef CONFIG_OCFS2_FS_POSIX_ACL | ||
1417 | case Opt_acl: | 1424 | case Opt_acl: |
1418 | mopt->mount_opt |= OCFS2_MOUNT_POSIX_ACL; | 1425 | mopt->mount_opt |= OCFS2_MOUNT_POSIX_ACL; |
1426 | mopt->mount_opt &= ~OCFS2_MOUNT_NO_POSIX_ACL; | ||
1419 | break; | 1427 | break; |
1420 | case Opt_noacl: | 1428 | case Opt_noacl: |
1429 | mopt->mount_opt |= OCFS2_MOUNT_NO_POSIX_ACL; | ||
1421 | mopt->mount_opt &= ~OCFS2_MOUNT_POSIX_ACL; | 1430 | mopt->mount_opt &= ~OCFS2_MOUNT_POSIX_ACL; |
1422 | break; | 1431 | break; |
1423 | #else | ||
1424 | case Opt_acl: | ||
1425 | case Opt_noacl: | ||
1426 | printk(KERN_INFO "ocfs2 (no)acl options not supported\n"); | ||
1427 | break; | ||
1428 | #endif | ||
1429 | default: | 1432 | default: |
1430 | mlog(ML_ERROR, | 1433 | mlog(ML_ERROR, |
1431 | "Unrecognized mount option \"%s\" " | 1434 | "Unrecognized mount option \"%s\" " |
@@ -1502,12 +1505,10 @@ static int ocfs2_show_options(struct seq_file *s, struct vfsmount *mnt) | |||
1502 | if (opts & OCFS2_MOUNT_INODE64) | 1505 | if (opts & OCFS2_MOUNT_INODE64) |
1503 | seq_printf(s, ",inode64"); | 1506 | seq_printf(s, ",inode64"); |
1504 | 1507 | ||
1505 | #ifdef CONFIG_OCFS2_FS_POSIX_ACL | ||
1506 | if (opts & OCFS2_MOUNT_POSIX_ACL) | 1508 | if (opts & OCFS2_MOUNT_POSIX_ACL) |
1507 | seq_printf(s, ",acl"); | 1509 | seq_printf(s, ",acl"); |
1508 | else | 1510 | else |
1509 | seq_printf(s, ",noacl"); | 1511 | seq_printf(s, ",noacl"); |
1510 | #endif | ||
1511 | 1512 | ||
1512 | return 0; | 1513 | return 0; |
1513 | } | 1514 | } |
diff --git a/fs/ocfs2/symlink.c b/fs/ocfs2/symlink.c index e3421030a69f..49b133ccbf11 100644 --- a/fs/ocfs2/symlink.c +++ b/fs/ocfs2/symlink.c | |||
@@ -163,6 +163,7 @@ const struct inode_operations ocfs2_symlink_inode_operations = { | |||
163 | .getxattr = generic_getxattr, | 163 | .getxattr = generic_getxattr, |
164 | .listxattr = ocfs2_listxattr, | 164 | .listxattr = ocfs2_listxattr, |
165 | .removexattr = generic_removexattr, | 165 | .removexattr = generic_removexattr, |
166 | .fiemap = ocfs2_fiemap, | ||
166 | }; | 167 | }; |
167 | const struct inode_operations ocfs2_fast_symlink_inode_operations = { | 168 | const struct inode_operations ocfs2_fast_symlink_inode_operations = { |
168 | .readlink = ocfs2_readlink, | 169 | .readlink = ocfs2_readlink, |
@@ -174,4 +175,5 @@ const struct inode_operations ocfs2_fast_symlink_inode_operations = { | |||
174 | .getxattr = generic_getxattr, | 175 | .getxattr = generic_getxattr, |
175 | .listxattr = ocfs2_listxattr, | 176 | .listxattr = ocfs2_listxattr, |
176 | .removexattr = generic_removexattr, | 177 | .removexattr = generic_removexattr, |
178 | .fiemap = ocfs2_fiemap, | ||
177 | }; | 179 | }; |
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index 43c114831c0d..8fc6fb071c6d 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c | |||
@@ -98,10 +98,8 @@ static struct ocfs2_xattr_def_value_root def_xv = { | |||
98 | 98 | ||
99 | struct xattr_handler *ocfs2_xattr_handlers[] = { | 99 | struct xattr_handler *ocfs2_xattr_handlers[] = { |
100 | &ocfs2_xattr_user_handler, | 100 | &ocfs2_xattr_user_handler, |
101 | #ifdef CONFIG_OCFS2_FS_POSIX_ACL | ||
102 | &ocfs2_xattr_acl_access_handler, | 101 | &ocfs2_xattr_acl_access_handler, |
103 | &ocfs2_xattr_acl_default_handler, | 102 | &ocfs2_xattr_acl_default_handler, |
104 | #endif | ||
105 | &ocfs2_xattr_trusted_handler, | 103 | &ocfs2_xattr_trusted_handler, |
106 | &ocfs2_xattr_security_handler, | 104 | &ocfs2_xattr_security_handler, |
107 | NULL | 105 | NULL |
@@ -109,12 +107,10 @@ struct xattr_handler *ocfs2_xattr_handlers[] = { | |||
109 | 107 | ||
110 | static struct xattr_handler *ocfs2_xattr_handler_map[OCFS2_XATTR_MAX] = { | 108 | static struct xattr_handler *ocfs2_xattr_handler_map[OCFS2_XATTR_MAX] = { |
111 | [OCFS2_XATTR_INDEX_USER] = &ocfs2_xattr_user_handler, | 109 | [OCFS2_XATTR_INDEX_USER] = &ocfs2_xattr_user_handler, |
112 | #ifdef CONFIG_OCFS2_FS_POSIX_ACL | ||
113 | [OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS] | 110 | [OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS] |
114 | = &ocfs2_xattr_acl_access_handler, | 111 | = &ocfs2_xattr_acl_access_handler, |
115 | [OCFS2_XATTR_INDEX_POSIX_ACL_DEFAULT] | 112 | [OCFS2_XATTR_INDEX_POSIX_ACL_DEFAULT] |
116 | = &ocfs2_xattr_acl_default_handler, | 113 | = &ocfs2_xattr_acl_default_handler, |
117 | #endif | ||
118 | [OCFS2_XATTR_INDEX_TRUSTED] = &ocfs2_xattr_trusted_handler, | 114 | [OCFS2_XATTR_INDEX_TRUSTED] = &ocfs2_xattr_trusted_handler, |
119 | [OCFS2_XATTR_INDEX_SECURITY] = &ocfs2_xattr_security_handler, | 115 | [OCFS2_XATTR_INDEX_SECURITY] = &ocfs2_xattr_security_handler, |
120 | }; | 116 | }; |
@@ -6064,7 +6060,7 @@ static int ocfs2_value_metas_in_xattr_header(struct super_block *sb, | |||
6064 | * to the extent block, so just calculate a maximum record num. | 6060 | * to the extent block, so just calculate a maximum record num. |
6065 | */ | 6061 | */ |
6066 | if (!xv->xr_list.l_tree_depth) | 6062 | if (!xv->xr_list.l_tree_depth) |
6067 | *num_recs += xv->xr_list.l_next_free_rec; | 6063 | *num_recs += le16_to_cpu(xv->xr_list.l_next_free_rec); |
6068 | else | 6064 | else |
6069 | *num_recs += ocfs2_clusters_for_bytes(sb, | 6065 | *num_recs += ocfs2_clusters_for_bytes(sb, |
6070 | XATTR_SIZE_MAX); | 6066 | XATTR_SIZE_MAX); |
diff --git a/fs/ocfs2/xattr.h b/fs/ocfs2/xattr.h index 08e36389f56d..abd72a47f520 100644 --- a/fs/ocfs2/xattr.h +++ b/fs/ocfs2/xattr.h | |||
@@ -40,10 +40,8 @@ struct ocfs2_security_xattr_info { | |||
40 | extern struct xattr_handler ocfs2_xattr_user_handler; | 40 | extern struct xattr_handler ocfs2_xattr_user_handler; |
41 | extern struct xattr_handler ocfs2_xattr_trusted_handler; | 41 | extern struct xattr_handler ocfs2_xattr_trusted_handler; |
42 | extern struct xattr_handler ocfs2_xattr_security_handler; | 42 | extern struct xattr_handler ocfs2_xattr_security_handler; |
43 | #ifdef CONFIG_OCFS2_FS_POSIX_ACL | ||
44 | extern struct xattr_handler ocfs2_xattr_acl_access_handler; | 43 | extern struct xattr_handler ocfs2_xattr_acl_access_handler; |
45 | extern struct xattr_handler ocfs2_xattr_acl_default_handler; | 44 | extern struct xattr_handler ocfs2_xattr_acl_default_handler; |
46 | #endif | ||
47 | extern struct xattr_handler *ocfs2_xattr_handlers[]; | 45 | extern struct xattr_handler *ocfs2_xattr_handlers[]; |
48 | 46 | ||
49 | ssize_t ocfs2_listxattr(struct dentry *, char *, size_t); | 47 | ssize_t ocfs2_listxattr(struct dentry *, char *, size_t); |