summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix/src/posix-common.c
diff options
context:
space:
mode:
authorShreyas Siravara <sshreyas@fb.com>2017-09-07 16:36:29 -0700
committerKrutika Dhananjay <kdhananj@redhat.com>2017-12-08 09:07:35 +0000
commit5a29779aceec59069511cec7eff9b314e819eacc (patch)
treef2641d7f453eb3e770942b2fda3a654c23f169d8 /xlators/storage/posix/src/posix-common.c
parent97a97bab57873083d5b49f636fd0ccbe94a310e3 (diff)
storage/posix: Add limit to number of hard links
Summary: Too may hard links blow up btrfs by exceeding max xattr size (recordign pgfid for each hardlink). Add a limit to prevent this explosion. > Reviewed-on: https://review.gluster.org/18232 > Reviewed-by: Shreyas Siravara <sshreyas@fb.com> Fixes gluster/glusterfs#370 Signed-off-by: ShyamsundarR <srangana@redhat.com> Change-Id: I614a247834fb8f2b2743c0c67d11cefafff0dbaa
Diffstat (limited to 'xlators/storage/posix/src/posix-common.c')
-rw-r--r--xlators/storage/posix/src/posix-common.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/xlators/storage/posix/src/posix-common.c b/xlators/storage/posix/src/posix-common.c
index 011bef8a720..1b2bb609fb0 100644
--- a/xlators/storage/posix/src/posix-common.c
+++ b/xlators/storage/posix/src/posix-common.c
@@ -398,6 +398,8 @@ posix_reconfigure (xlator_t *this, dict_t *options)
options, int32, out);
priv->create_directory_mask = create_directory_mask;
+ GF_OPTION_RECONF ("max-hardlinks", priv->max_hardlinks,
+ options, uint32, out);
ret = 0;
out:
return ret;
@@ -1075,6 +1077,8 @@ posix_init (xlator_t *this)
GF_OPTION_INIT ("create-directory-mask",
create_directory_mask, int32, out);
_private->create_directory_mask = create_directory_mask;
+
+ GF_OPTION_INIT ("max-hardlinks", _private->max_hardlinks, uint32, out);
out:
if (ret) {
if (_private) {
@@ -1322,5 +1326,17 @@ struct volume_options options[] = {
.description = "Any bit not set here will be removed from the"
"modes set on a directory when it is created"
},
+ {
+ .key = {"max-hardlinks"},
+ .type = GF_OPTION_TYPE_INT,
+ .min = 0,
+ .default_value = "100",
+ .op_version = {GD_OP_VERSION_4_0_0},
+ .flags = OPT_FLAG_SETTABLE | OPT_FLAG_DOC,
+ .tags = {"posix"},
+ .validate = GF_OPT_VALIDATE_MIN,
+ .description = "max number of hardlinks allowed on any one inode.\n"
+ "0 is unlimited, 1 prevents any hardlinking at all."
+ },
{ .key = {NULL} }
};