summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorVinayakswami Hariharmath <vharihar@redhat.com>2021-01-25 17:32:14 +0530
committerXavi Hernandez <xhernandez@users.noreply.github.com>2021-01-26 10:12:51 +0100
commit22910dcc1046e3d7eeaba89b05093a6fcc37e172 (patch)
tree7ec484ea42901c2e7452ae822a5fe2e2a68e0e99 /xlators
parentaff178134ac8fe3b81f117df4df35cf873904493 (diff)
downloadglusterfs-22910dcc1046e3d7eeaba89b05093a6fcc37e172.tar.gz
glusterfs-22910dcc1046e3d7eeaba89b05093a6fcc37e172.tar.xz
glusterfs-22910dcc1046e3d7eeaba89b05093a6fcc37e172.zip
features/shard: unlink fails due to nospace to mknod marker file
When we hit the max capacity of the storage space, shard_unlink() starts failing if there is no space left on the brick to create a marker file. shard_unlink() happens in below steps: 1. create a marker file in the name of gfid of the base file under BRICK_PATH/.shard/.remove_me 2. unlink the base file 3. shard_delete_shards() deletes the shards in background by picking the entries in BRICK_PATH/.shard/.remove_me If a marker file creation fails then we can't really delete the shards which eventually a problem for user who is looking to make space by deleting unwanted data. Solution: Create the marker file by marking xdata = GLUSTERFS_INTERNAL_FOP_KEY which is considered to be internal op and allowed to create under reserved space. Fixes: #2038 Change-Id: I7facebab940f9aeee81d489df429e00ef4fb7c5d Signed-off-by: Vinayakswami Hariharmath <vharihar@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/features/shard/src/shard.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/xlators/features/shard/src/shard.c b/xlators/features/shard/src/shard.c
index 6526e13686..091f820caa 100644
--- a/xlators/features/shard/src/shard.c
+++ b/xlators/features/shard/src/shard.c
@@ -4087,6 +4087,16 @@ shard_create_marker_file_under_remove_me(call_frame_t *frame, xlator_t *this,
SHARD_INODE_CREATE_INIT(this, bs, xattr_req, &local->newloc,
local->prebuf.ia_size, 0, err);
+ /* Mark this as an internal operation, so that in case of disk full,
+ * the marker file will be created as part of reserve space */
+ ret = dict_set_int32_sizen(xattr_req, GLUSTERFS_INTERNAL_FOP_KEY, 1);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, SHARD_MSG_DICT_OP_FAILED,
+ "Failed to set key: %s on path %s", GLUSTERFS_INTERNAL_FOP_KEY,
+ local->newloc.path);
+ goto err;
+ }
+
STACK_WIND(frame, shard_create_marker_file_under_remove_me_cbk,
FIRST_CHILD(this), FIRST_CHILD(this)->fops->mknod,
&local->newloc, 0, 0, 0644, xattr_req);
@@ -5848,6 +5858,16 @@ shard_mkdir_internal_dir(call_frame_t *frame, xlator_t *this,
SHARD_SET_ROOT_FS_ID(frame, local);
+ /* Mark this as an internal operation, so that in case of disk full
+ * the internal dir will be created as part of reserve space */
+ ret = dict_set_int32_sizen(xattr_req, GLUSTERFS_INTERNAL_FOP_KEY, 1);
+ if (ret < 0) {
+ gf_msg(this->name, GF_LOG_WARNING, 0, SHARD_MSG_DICT_OP_FAILED,
+ "Failed to set key: %s on path %s", GLUSTERFS_INTERNAL_FOP_KEY,
+ loc->path);
+ goto err;
+ }
+
STACK_WIND_COOKIE(frame, shard_mkdir_internal_dir_cbk, (void *)(long)type,
FIRST_CHILD(this), FIRST_CHILD(this)->fops->mkdir, loc,
0755, 0, xattr_req);