diff options
author | N Balachandran <nbalacha@redhat.com> | 2018-09-07 14:10:37 +0530 |
---|---|---|
committer | N Balachandran <nbalacha@redhat.com> | 2018-09-10 14:22:41 +0000 |
commit | 515074156db5492b22ee8db58e0b91caeed8f60c (patch) | |
tree | 83bf4e49c52ab52a9ee89e2f76264867996310f2 /xlators | |
parent | 05e64dab56c4560cbeaacd5089d6e16f6eb295d2 (diff) |
cluster/dht: Create a linkto file if required
Using the dht_filter_loc_subvol_key to create
files on specific subvols did not create a linkto
file. This can make the file inaccessible as
lookup-optimize is now enabled by default.
Change-Id: I78add5a31887378a479cb9c746b91678876b0dbe
fixes: bz#1626394
Signed-off-by: N Balachandran <nbalacha@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/cluster/dht/src/dht-common.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 4efc2814729..129acbef0b5 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -9141,6 +9141,7 @@ dht_create (call_frame_t *frame, xlator_t *this, { int op_errno = -1; xlator_t *subvol = NULL; + xlator_t *hashed_subvol = NULL; dht_local_t *local = NULL; int i = 0; dht_conf_t *conf = NULL; @@ -9166,6 +9167,35 @@ dht_create (call_frame_t *frame, xlator_t *this, DHT_MSG_SUBVOL_INFO, "creating %s on %s (got create on %s)", local->loc.path, subvol->name, loc->path); + + /* Since lookup-optimize is enabled by default, we need + * to create the linkto file if required. + * Note this does not check for decommisioned bricks + * and min-free-disk limits as this is a debugging tool + * and not expected to be used in production. + */ + hashed_subvol = dht_subvol_get_hashed (this, &local->loc); + + if (hashed_subvol && (hashed_subvol != subvol)) { + /* Create the linkto file and then the data file */ + local->params = dict_ref (params); + local->flags = flags; + local->mode = mode; + local->umask = umask; + local->cached_subvol = subvol; + local->hashed_subvol = hashed_subvol; + + dht_linkfile_create (frame, + dht_create_linkfile_create_cbk, + this, subvol, hashed_subvol, + &local->loc); + goto done; + } + /* We either don't have a hashed subvol or the hashed subvol is + * the same as the one specified. No need to create the linkto + * file as we expect a lookup everywhere if there are problems + * with the parent layout + */ STACK_WIND_COOKIE (frame, dht_create_cbk, subvol, subvol, subvol->fops->create, &local->loc, flags, mode, umask, fd, params); |