summaryrefslogtreecommitdiffstats
path: root/xlators/storage
diff options
context:
space:
mode:
authorN Balachandran <nbalacha@redhat.com>2018-08-21 20:57:52 +0530
committerAmar Tumballi <amarts@redhat.com>2018-08-23 06:49:11 +0000
commitdad85784e74493158a186536d6c13183c83fc658 (patch)
tree7be19eab86ce347619c2774e1f0fd10ab18aa77d /xlators/storage
parent9ec821f9e67848b3527f6b7dc776cb9ba440610b (diff)
storage/posix: Increment trusted.pgfid in posix_mknod
The value of trusted.pgfid.xx was always set to 1 in posix_mknod. This is incorrect if posix_mknod calls posix_create_link_if_gfid_exists. Change-Id: Ibe87ca6f155846b9a7c7abbfb1eb8b6a99a5eb68 fixes: bz#1619720 Signed-off-by: N Balachandran <nbalacha@redhat.com>
Diffstat (limited to 'xlators/storage')
-rw-r--r--xlators/storage/posix/src/posix-entry-ops.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/xlators/storage/posix/src/posix-entry-ops.c b/xlators/storage/posix/src/posix-entry-ops.c
index acda68371d5..11ce9d69540 100644
--- a/xlators/storage/posix/src/posix-entry-ops.c
+++ b/xlators/storage/posix/src/posix-entry-ops.c
@@ -351,6 +351,7 @@ posix_mknod (call_frame_t *frame, xlator_t *this,
gf_boolean_t linked = _gf_false;
gf_loglevel_t level = GF_LOG_NONE;
mode_t mode_bit = 0;
+ posix_inode_ctx_t *ctx = NULL;
DECLARE_OLD_FS_ID_VAR;
@@ -466,10 +467,20 @@ post_op:
if (priv->update_pgfid_nlinks) {
MAKE_PGFID_XATTR_KEY (pgfid_xattr_key, PGFID_XATTR_KEY_PREFIX,
loc->pargfid);
- nlink_samepgfid = 1;
+ op_ret = posix_inode_ctx_get_all (loc->inode, this, &ctx);
+ if (op_ret < 0) {
+ op_errno = ENOMEM;
+ goto out;
+ }
- SET_PGFID_XATTR (real_path, pgfid_xattr_key, nlink_samepgfid,
- XATTR_CREATE, op_ret, this, ignore);
+ pthread_mutex_lock (&ctx->pgfid_lock);
+ {
+ LINK_MODIFY_PGFID_XATTR (real_path, pgfid_xattr_key,
+ nlink_samepgfid, 0, op_ret,
+ this, unlock);
+ }
+unlock:
+ pthread_mutex_unlock (&ctx->pgfid_lock);
}
if (priv->gfid2path) {
@@ -477,7 +488,6 @@ post_op:
loc->name);
}
-ignore:
op_ret = posix_entry_create_xattr_set (this, real_path, xdata);
if (op_ret) {
if (errno != EEXIST)