summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix
Commit message (Collapse)AuthorAgeFilesLines
* posix: fix GF_VALIDATE_OR_GOTO(this->name, this, out)Sanju Rakonde2020-04-161-3/+1
| | | | | | | | | | | | | | | Remove GF_VALIDATE_OR_GOTO(this->name, this, out) when this is passed as an argument and is checked for NULL in the caller itself. GF_VALIDATE_OR_GOTO(this->name, this, out) is modified to use xlator name instead of this->name as we are still verifying whether this is NULL. updates: #1000 Change-Id: Ide3180da29d0d4a35b2c5b9a7604fdf2ff4a9ffb Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
* posix: Avoid dict_del logs in posix_is_layout_stale while key is NULLMohit Agrawal2020-04-091-2/+3
| | | | | | | | | | | | Problem: The key "GF_PREOP_PARENT_KEY" has been populated by dht and for non-distribute volume like 1x3 key is not populated so posix_is_layout stale throw a message while a file is created Solution: To avoid a log put a condition before delete a key Change-Id: I813ee7960633e7f9f5e9ad2f42f288053d9eb71f Fixes: #1150 Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
* dht - fixing a permission update issueBarak Sason Rofman2020-04-081-10/+6
| | | | | | | | | | | | | | | | | | When bringing back a downed brick and performing lookup from the client side, the permission on said brick aren't updated on the first lookup, but only on the second. This patch modifies permission update logic so the first lookup will trigger a permission update on the downed brick. LIMITATIONS OF THE PATCH: As the choice of source depends on whether the directory has layout or not. Even the directories on the newly added brick will have layout xattr[zeroed], but the same is not true for a root directory. Hence, in case in the entire cluster only the newly added bricks are up [and others are down], then any change in permission during this time will be overwritten by the older permissions when the cluster is restarted. fixes: #999 Change-Id: Ieb70246d41e59f9cae9f70bc203627a433dfbd33 Signed-off-by: Barak Sason Rofman <bsasonro@redhat.com>
* Posix: Optimize posix code to improve file creationMohit Agrawal2020-04-065-74/+220
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Before executing a fop in POSIX xlator it builds an internal path based on GFID.To validate the path it call's (l)stat system call and while .glusterfs is heavily loaded kernel takes time to lookup inode and due to that performance drops Solution: In this patch we followed two ways to improve the performance. 1) Keep open fd specific to first level directory(gfid[0]) in .glusterfs, it would force to kernel keep the inodes from all those files in cache. In case of memory pressure kernel won't uncache first level inodes. We need to open 256 fd's per brick to access the entry faster. 2) Use at based call's to access relative path to reduce path based lookup time. Note: To verify the patch we have executed kernel untar 100 times on 6 different clients after enabling metadata group-cache and some other option.We were getting more than 20 percent improvement in kenel untar after applying the patch. Credits: Xavi Hernandez <xhernandez@redhat.com> Change-Id: I1643e6b01ed669b2bb148d02f4e6a8e08da45343 updates: #891 Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
* storage/posix: log the ENOENT errors in posix_pstatRaghavendra Bhat2020-04-041-0/+5
| | | | | | Change-Id: I93f11dae6e4939ab79b0481ead2a4f7bb3085b70 Fixes: #1142 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
* Posix: Use simple approach to close fdMohit Agrawal2020-03-204-127/+6
| | | | | | | | | | | | | | | Problem: posix_release(dir) functions add the fd's into a ctx->janitor_fds and janitor thread closes the fd's.In brick_mux environment it is difficult to handle race condition in janitor threads because brick spawns a single janitor thread for all bricks. Solution: Use synctask to execute posix_release(dir) functions instead of using background a thread to close fds. Credits: Pranith Karampuri <pkarampu@redhat.com> Change-Id: Iffb031f0695a7da83d5a2f6bac8863dad225317e Fixes: bz#1811631 Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
* Posix: structs re-aligned and manual padding addedPurna Pavan Chandra Aekkaladevi2020-03-092-44/+52
| | | | | | | | | | | | All the structs present inside xlators/storage/posix have been re-aligned into memory efficient way. Manual padding has been added to remove compile time padding. This manual padding is for development and debugging benefits. It lets to use -Wpadded option and raise warnings from the remaining structs where compile time padding happens. Change-Id: Ie72c02810803eae29fca435c71aa131a1315b8a8 Updates: bz#1754448 Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkala@redhat.com>
* dht: Fix stale-layout and create issueSusant Palai2020-02-093-1/+108
| | | | | | | | | | | | | | | | | Problem: With lookup-optimize set to on by default, a client with stale-layout can create a new file on a wrong subvol. This will lead to possible duplicate files if two different clients attempt to create the same file with two different layouts. Solution: Send in-memory layout to be cross checked at posix before commiting a "create". In case of a mismatch, sync the client layout with that of the server and attempt the create fop one more time. test: Manual, testcase(attached) fixes: bz#1786679 Change-Id: Ife0941f105113f1c572f4363cbcee65e0dd9bd6a Signed-off-by: Susant Palai <spalai@redhat.com>
* posix-entry-ops.c/posix.h: improve GFID_NULL_CHECK_AND_GOTO macroYaniv Kaul2020-01-212-19/+31
| | | | | | | | | | | The macro already fetches from the dictionary the gfid-req variable. Instead of throwing it away, keep it and in 2 cases, re-use it later. updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com> Change-Id: Id6d42535132805ab69e7e3b802c140b90f2f8958
* xlators/storage: remove duplicated includesDmitry Antipov2020-01-133-3/+0
| | | | | | | | Do not include ftw.h twice. Change-Id: Id9e8d1813aafd890940adcd6883d90fa1b4beaf9 Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Updates: bz#1193929
* xlators/storage: prefer HAVE_xxx to host C library predefinesDmitry Antipov2020-01-131-5/+1
| | | | | | | | | Rely on configure-time HAVE_SET_FSID instead of predefined linux and __GLIBC__, in the same way as fusermount.c does. Change-Id: If81f821014bbf3fdc43950670e316b4d178b4cac Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Updates: bz#1193929
* multiple: fix bad type castXavi Hernandez2020-01-102-11/+27
| | | | | | | | | | | | When using inode_ctx_get() or inode_ctx_set(), a 'uint64_t *' is expected. In many cases, the value to retrieve or store is a pointer, which will be of smaller size in some architectures (for example 32-bits). In this case, directly passing the address of the pointer casted to an 'uint64_t *' is wrong and can cause memory corruption. Change-Id: Iae616da9dda528df6743fa2f65ae5cff5ad23258 Signed-off-by: Xavi Hernandez <xhernandez@redhat.com> Fixes: bz#1785611
* posix-metadata.c: try to getxattr in one call.Yaniv Kaul2020-01-061-48/+61
| | | | | | | | | | | | | | | | | Another location where instead of 2 sys calls we strive to get the xattr in a single call, by guesstimating the required size And avoid (or try to) not to first read the xattr len, then another call to actually fetch. Instead, use a sane size (256 bytes - worth checking if it makes sense or by default use a larger size), and see if we can fetch it. If we fail, we'll read the size and re-fetch. Such changes are needed elsewhere too (see https://github.com/gluster/glusterfs/issues/720 ) Change-Id: I466cea9d8b12fc45f6b37d202b1294ca28cd1fdd updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* posix: improve posix_{set_gfid2path_xattr|remove_gfid2path_xattr} funcsYaniv Kaul2020-01-033-81/+64
| | | | | | | | | | 1. Move them to posix-entry-ops.c and make them static. 2. Remove useless 'val' parameter allocation and snprintf() in posix_set_gfid2path_xattr(), as it was identical to pgfid_bname. Change-Id: I41f3946c6c42aee9d7cf1150e21b442438fbcce2 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* posix-inode-fd-ops.c: fix a compiler warning - real_path may be NULLYaniv Kaul2020-01-011-1/+1
| | | | | | | | | | | | | | | | | | | | Fixes the following: posix-inode-fd-ops.c: In function ‘posix_common_removexattr’: ../../../../libglusterfs/src/glusterfs/logging.h:231:9: warning: ‘%s’ directive argument is null [-Wformat-overflow=] 231 | _gf_msg(dom, __FILE__, __FUNCTION__, __LINE__, level, errnum, 0, \ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 232 | msgid, ##fmt); \ | ~~~~~~~~~~~~~ posix-inode-fd-ops.c:4401:13: note: in expansion of macro ‘gf_msg’ 4401 | gf_msg(this->name, GF_LOG_WARNING, errno, P_MSG_FDSTAT_FAILED, | ^~~~~~ posix-inode-fd-ops.c:4402:47: note: format string is defined here 4402 | "fdstat operaton failed on %s", real_path); | ^~ Change-Id: I3f2278d3a05a569dde257d66f44a8655491b4013 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* posix: Avoid diskpace error in case of overwriting the dataMohit Agrawal2020-01-012-17/+125
| | | | | | | | | | | | | | Problem: Sometime fops like posix_writev, posix_fallocate, posix_zerofile failed and throw error ENOSPC if storage.reserve threshold limit has reached even fops is overwriting the data Solution: Retry the fops in case of overwrite if diskspace check is failed Credits: kinsu <vpolakis@gmail.com> Change-Id: I987d73bcf47ed1bb27878df40c39751296e95fe8 Updates: #745 Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
* posix-entry-ops.c: remove some tier related codeYaniv Kaul2020-01-012-26/+0
| | | | | | | | | | | Remove TIER_LINKFILE_GFID related code from posix Tier xlator was removed, but there are some code related to it scattered around in DHT and Posix xlators. Remove some of it. Change-Id: I3a878b31ed4a045ed419f936aa1d567ded1a273f updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* Avoid buffer overwrite due to uuid_utoa() misuseDmitry Antipov2019-12-272-4/+8
| | | | | | | | | | | | | | | Code like: f(..., uuid_utoa(x), uuid_utoa(y)); is not valid (causes undefined behaviour) because uuid_utoa() uses the only static thread-local buffer which will be overwritten by the subsequent call. All such cases should be converted to use uuid_utoa_r() with explicitly specified buffer. Change-Id: I5e72bab806d96a9dd1707c28ed69ca033b9c8d6c Updates: bz#1193929 Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru>
* debug/io-stats: add an option to set volume-idAmar Tumballi2019-11-291-6/+0
| | | | | | | | | | | 'volume-id' is good to have for a graph for uniquely identifying it. Add it to graph->volume_id while generating volfile itself. This can be further used in many other places. Updates: #763 Change-Id: I80516d62d28a284e8ff4707841570ced97a37e73 Signed-off-by: Amar Tumballi <amar@kadalu.io>
* posix-inode-fd-ops.c: excute sys_fstat() only when neededYaniv Kaul2019-11-271-7/+16
| | | | | | | | | | | It appears that in posix_do_futimes() we may not need to unconditionally execute sys_fstat(). Avoid it and use the existing stbuf atime and mtime if possible. If not, we execute it. Change-Id: I0bdd471e5c821fcd28f057c75046c673a212d347 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* posix: Improve MAKE_HANDLE_PATHMohit Agrawal2019-11-183-32/+17
| | | | | | | | | Pass the maximum buffer (PATH_MAX) to posix_handle_path to avoid the posix_handle_path call again. Change-Id: I7d18313870218dc028c5f7fc94d6ec85a2bdb332 Updates #761 Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
* posix: Improve MAKE_HANDLE_GFID_PATH and MAKE_HANDLE_RELPATHMohit Agrawal2019-11-115-42/+26
| | | | | | | | Avoid one function call to set the gfid_path in buffer Change-Id: If9b95801b05c34d262fac9a275492c794d12bf58 Updates #748 Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
* posix-helpers.c (and others): minor changes to posix_xattr_fill()Yaniv Kaul2019-11-063-39/+43
| | | | | | | | | | | | | | | | posix_xattr_fill() is called from several POSIX functions. Made minor changes to it and the functions called from it: 1. Dict functions to use known lengths (dict_getn() instead of dict_get(), etc.) 2. Re-ordered some static char[] arrays, to account (hopefully) to the frequency of the xattrs usage (based on grep in the code...) 3. Before strcmp(), check if the strings lengths match. 4. Removed some dead code. Hopefully, no functional changes. Change-Id: I510c0d2785e54ffe0f82c4c449782f2302d63a32 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* posix-entry-ops.c: pass correct key length in posix_skip_non_linkto_unlink()Yaniv Kaul2019-11-041-4/+6
| | | | | | | | | | | | | | | | As was found out in a different patch, passing a pointer to a constant string still calculates the size of the pointer and not the string. This is not catastrophic as the dictionary is matching not just hashes but key names, but is certainly what was intended to be done. Instead, pass explicitly the key lenth. I've looked for additional cases for such an issue and did not find them, luckily. Change-Id: I644a07a77dd541e9cf4886811ab54897e0c9d483 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* posix-entry-ops: do not copy when reading xattrYaniv Kaul2019-10-211-68/+91
| | | | | | | | | | | | | | The code is simplified to avoid needless copy as well as simplified overall for readability. Such changes are needed elsewhere too (see https://github.com/gluster/glusterfs/issues/720 ) Few other minor changes here and there, nothing functional. updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com> Change-Id: I14f9dd2c32a8932bfcc80ebe92c9aa77701095ff
* posix-helper.c: fix compile warn: ‘timeout’ may be used uninitializedYaniv Kaul2019-10-181-1/+1
| | | | | | | | | | | | | | | | | https://review.gluster.org/#/c/glusterfs/+/23439/ introduced this warning: In file included from posix-helpers.c:50: posix-helpers.c: In function ‘posix_health_check_thread_proc’: ../../../../libglusterfs/src/glusterfs/events.h:31:9: warning: ‘timeout’ may be used uninitialized in this function [-Wmaybe-uninitialized] 31 | _gf_event(event, ##fmt); \ | ^~~~~~~~~ posix-helpers.c:2024:9: note: ‘timeout’ was declared here 2024 | int timeout; This patch fixes it, by re-setting the initial value to 0. Change-Id: I90aee4a1366e21a00f5e138f44247d8c42b0f5ae updates: bz#789278 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* posix-helpers.c: minor changes to posix_fs_health_checkYaniv Kaul2019-10-151-24/+21
| | | | | | | | | Do not sprintf the path in every invocation. Initialize parameters sooner. Change-Id: I26bfffc5dab6530937a50eee1e7fc4982e9b2a7c updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* Multiple files: make root gfid a static variableYaniv Kaul2019-10-142-2/+2
| | | | | | | | | | | | | In many places we use it, compare to it, etc. It could be a static variable, as it really doesn't change. I think it's better than initializing to 0 and then doing gfid[15] = 1 or other tricks. I think there are additional oppportunuties to make more variables static. This is an attempt at an easy one. Change-Id: I7f23a30a94056d8f043645371ab841cbd0f90d19 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* POSIX/xlators: Unused and unchecked value coverity issueyatipadia2019-10-111-2/+2
| | | | | | | | | | | | | | | | | | This patch addresses CID-1274094 and CID-1382354 Problem(1): "ret" was assigned a value which was never used, it was overwritten by 0 and hence has no use. Problem(2): function was called without checking the return value. Solution(1): Removed the assignment and just called the function whose value was being written in ret. Solution(2): There was no need to check for the return value as at the end 0 is returned, so typecasted the return value as void. Change-Id: Iefd0e9000c466ef2428c754c31370263bf1ca0d0 updates: bz#789278
* Posix: UNUSED VALUE coverity fixPurna Pavan Chandra Aekkaladevi2019-10-111-2/+0
| | | | | | | | | | | | This patch fixes Coverity issue with CID 1274206 Problem : -1 is assigned to op_ret, but that stored value is overwritten before it can be used. Fix : Removal of the line that assigns -1 to op_ret which has no significance. Change-Id: Icb881549ac946003710551c9b9e88b33b6a06239 Updates: bz#789278 Signed-off-by: Purna Pavan Chandra Aekkaladevi <paekkala@redhat.com>
* posix-helpers.c: do not copy when reading xattrYaniv Kaul2019-10-111-47/+51
| | | | | | | | | | | | | The code is simplified to avoid needless copy as well as simplified overall for readability. Such changes are needed elsewhere too (see https://github.com/gluster/glusterfs/issues/720 ) Few other minor changes here and there, nothing functional. Change-Id: Ia1167849f54d9cacbfe32ddd712dc1699760daf5 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* protocol/handshake: pass volume-id for extra checkAmar Tumballi2019-09-301-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With added check of volume-id during handshake, we can be sure to not connect with a brick if this gets re-used in another volume. This prevents any accidental issues which can happen with a stale client process lurking along. Also added test case for testing same volume name which would fetch a different volfile (ie, different bricks, different type), and a different volume name, but same brick. For reference: Currently a client<->server handshake happens in glusterfs through protocol/client translator (setvolume) to protocol/server using a dictionary which containes many keys. Rejection happens in server side if some of the required keys are missing in handshake dictionary. Till now, there was no single unique identifier to validate for a client to tell server if it is actually talking to a corresponding server. All we look in protocol/client is a key called 'remote-subvolume', which should match with a subvolume name in server volume file, and for any volume with same brick name (can be present in same cluster due to recreate), it would be same. This could cause major issue, when a client was connected to a given brick, in one volume would be connected to another volume's brick if its re-created/re-used. To prevent this behavior, we are now passing along 'volume-id' in handshake, which would be preserved for the life of client process, which can prevent this accidental connections. NOTE: This behavior wouldn't be applicable for user-snapshot enabled volumes, as snapshotted volume's would have different volume-id. Fixes: bz#1620580 Change-Id: Ie98286e94ce95ae09c2135fd6ec7d7c2ca1e8095 Signed-off-by: Amar Tumballi <amarts@redhat.com>
* posix: heketidbstorage bricks go down during PVC creationMohit Agrawal2019-09-301-1/+1
| | | | | | | | | | | | | Problem: In OCS environment heketidbstorage is detached due to health_check thread is failed.Sometime aio_write is not successfully finished within default health-check-timeout limit and the brick is detached. Solution: To avoid the issue increase default timeout to 20s Change-Id: Idff283d5713da571f9d20a6b296274f69c3e5b7b Fixes: bz#1755900 Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
* posix: Brick is going down unexpectedlyMohit Agrawal2019-09-261-4/+10
| | | | | | | | | | | | | Problem: In brick_mux environment, while multiple volumes are created (1-1000) sometimes brick is going down due to health_check thread failure Solution: Ignore EAGAIN error in health_check thread code to avoid the issue Change-Id: Id44c59f8e071a363a14d09d188813a6633855213 Fixes: bz#1751907 Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
* posix/ctime: Fix coverity issueKotresh HR2019-09-181-1/+1
| | | | | | | | | | | | | | | posix-metadata.c: 462 in posix_set_mdata_xattr() ... 460 GF_VALIDATE_OR_GOTO(this->name, time, out); 461 >>> CID 1405665: Control flow issues (DEADCODE) >>> Execution cannot reach the expression "flag->atime" inside this >>> statement: "if (update_utime && (flag->...". 462 if (update_utime && (flag->ctime && !time) && (flag->atime && !u_atime) && Change-Id: Id31d81d04ea2785a669eafe0dc1307303cb2271b updates: bz#789278 Signed-off-by: Kotresh HR <khiremat@redhat.com>
* ctime/rebalance: Heal ctime xattr on directory during rebalanceKotresh HR2019-09-166-48/+125
| | | | | | | | | | | | | | | | After add-brick and rebalance, the ctime xattr is not present on rebalanced directories on new brick. This patch fixes the same. Note that ctime still doesn't support consistent time across distribute sub-volume. This patch also fixes the in-memory inconsistency of time attributes when metadata is self healed. Change-Id: Ia20506f1839021bf61d4753191e7dc34b31bb2df fixes: bz#1734026 Signed-off-by: Kotresh HR <khiremat@redhat.com>
* posix*.c: remove unneeded strlen() callsYaniv Kaul2019-09-056-41/+37
| | | | | | | | | In various places, we can re-use knowledge of string length or result of snprintf() and such instead of strlen(). Change-Id: I4c9b1decf1169b3f8ac83699a0afbd7c38fad746 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* posix: log aio_error return codes in posix_fs_health_checkMohit Agrawal2019-08-221-3/+2
| | | | | | | | | | | | | Problem: Sometime brick is going down to health check thread is failed without logging error codes return by aio system calls. As per aio_error man page it returns a positive error number if the asynchronous I/O operation failed. Solution: log aio_error return codes in error message Change-Id: I2496b1bc16e602b0fd3ad53e211de11ec8c641ef Fixes: bz#1744519 Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
* storage/posix - Fixing a coverity issueBarak Sason2019-08-211-0/+1
| | | | | | | | | | Fixed a resource leak of variable 'pfd' CID: 1400673 Updates: bz#789278 Change-Id: I78e1e8a89e0604b56e35a75c25d436b35db096c3 Signed-off-by: Barak Sason <bsasonro@redhat.com>
* storage/posix - fixing a coverity issueBarak Sason2019-08-212-4/+21
| | | | | | | | | | CID: 1394644 & 1394639 Updates: bz#789278 Added logging in case method calls fails Change-Id: Ib833a5f68d37b98287b84c325637bc688937f647 Signed-off-by: Barak Sason <bsasonro@redhat.com>
* ctime: Fix ctime issue with utime family of syscallsKotresh HR2019-08-203-51/+56
| | | | | | | | | When atime|mtime is updated via utime family of syscalls, ctime is not updated. This patch fixes the same. Change-Id: I7f86d8f8a1e06a332c3449b5bbdbf128c9690f25 fixes: bz#1738786 Signed-off-by: Kotresh HR <khiremat@redhat.com>
* posix: In brick_mux brick is crashed while start/stop volume in loopMohit Agrawal2019-08-203-1/+58
| | | | | | | | | | | | | | | Problem: In brick_mux environment sometime brick is crashed while volume stop/start in a loop.Brick is crashed in janitor task at the time of accessing priv.If posix priv is cleaned up before call janitor task then janitor task is crashed. Solution: To avoid the crash in brick_mux environment introduce a new flag janitor_task_stop in posix_private and before send CHILD_DOWN event wait for update the flag by janitor_task_done Change-Id: Id9fa5d183a463b2b682774ab5cb9868357d139a4 fixes: bz#1730409 Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
* storage/posix - Moved pointed validity check in order to avoid possible ↵Barak Sason2019-08-201-3/+3
| | | | | | | | | | seg-fault CID: 1124831 Updates: bz#789278 Change-Id: Ia6550be3742849809cf3e0a4a39d9d6e77003b35 Signed-off-by: Barak Sason <bsasonro@redhat.com>
* libglusterfs: remove dependency of rpcAmar Tumballi2019-08-161-1/+0
| | | | | | | | | | | | | | | | | | Goal: 'libglusterfs' files shouldn't have any dependency outside of the tree, specially the header files, shouldn't have '#include' from outside the tree. Fixes: * Had to introduce libglusterd so, methods and structures required for only mgmt/glusterd, and cli/ are separated from 'libglusterfs/' * Remove rpc/xdr/gen from build, which was used mainly so dependency for libglusterfs could be properly satisfied. * Move rpcsvc_auth_data to client_t.h, so all dependencies could be handled. Updates: bz#1636297 Change-Id: I0e80243a5a3f4615e6fac6e1b947ad08a9363fce Signed-off-by: Amar Tumballi <amarts@redhat.com>
* posix: don't expect timer wheel to be initedRaghavendra Talur2019-08-141-1/+1
| | | | | | | | | | Adding a timer to timer wheel should be done only after getting the timer wheel from the ctx using the function glusterfs_ctx_tw_get(). The function inits the wheel if not already done. Change-Id: I9692f84b822a02a9dc14725b7c11d26a2a634e94 Updates: #703 Signed-off-by: Raghavendra Talur <rtalur@redhat.com>
* features/utime: always update ctime at setattrKinglong Mee2019-08-061-1/+1
| | | | | | | | | | | | | | | | | | | | For the nfs EXCLUSIVE mode create may sets a later time to mtime (at verifier), it should not set to ctime for storage.ctime does not allowed set ctime to a earlier time. /* Earlier, mdata was updated only if the existing time is less * than the time to be updated. This would fail the scenarios * where mtime can be set to any time using the syscall. Hence * just updating without comparison. But the ctime is not * allowed to changed to older date. */ According to kernel's setattr, always set ctime at setattr, and doesnot set ctime from mtime at storage.ctime. Change-Id: I5cfde6cb7f8939da9617506e3dc80bd840e0d749 fixes: bz#1737288 Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
* storage/posix: set the op_errno to proper errno during gfid setRaghavendra Bhat2019-08-041-0/+1
| | | | | | | | | In posix_gfid_set, the proper error is not captured in one of the failure cases. Change-Id: I1c13f0691a15d6893f1037b3a5fe385a99657e00 Fixes: bz#1736482 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
* Multiple files: get trivial stuff done before lockYaniv Kaul2019-08-011-8/+14
| | | | | | | | | Initialize a dictionary for example seems to be prefectly fine to be done before taking a lock. Change-Id: Ib29516c4efa8f0e2b526d512beab488fcd16d2e7 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* posix/ctime: Fix race during lookup ctime xattr healKotresh HR2019-08-011-18/+58
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Ctime heals the ctime xattr ("trusted.glusterfs.mdata") in lookup if it's not present. In a multi client scenario, there is a race which results in updating the ctime xattr to older value. e.g. Let c1 and c2 be two clients and file1 be the file which doesn't have the ctime xattr. Let the ctime of file1 be t1. (from backend, ctime heals time attributes from backend when not present). Now following operations are done on mount c1 -> ls -l /mnt/file1 | c2 -> ls -l /mnt/file1;echo "append" >> /mnt/file1; The race is that the both c1 and c2 didn't fetch the ctime xattr in lookup, so both of them tries to heal ctime to time 't1'. If c2 wins the race and appends the file before c1 heals it, it sets the time to 't1' and updates it to 't2' (because of append). Now c1 proceeds to heal and sets it to 't1' which is incorrect. Solution: Compare the times during heal and only update the larger time. This is the general approach used in ctime feature but got missed with healing legacy files. fixes: bz#1734299 Change-Id: I930bda192c64c3d49d0aed431ce23d3bc57e51b7 Signed-off-by: Kotresh HR <khiremat@redhat.com>
* ctime: Set mdata xattr on legacy filesKotresh HR2019-07-224-42/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem: The files which were created before ctime enabled would not have "trusted.glusterfs.mdata"(stores time attributes) xattr. Upon fops which modifies either ctime or mtime, the xattr gets created with latest ctime, mtime and atime, which is incorrect. It should update only the corresponding time attribute and rest from backend Solution: Creating xattr with values from brick is not possible as each brick of replica set would have different times. So create the xattr upon successful lookup if the xattr is not created Note To Reviewers: The time attributes used to set xattr is got from successful lookup. Instead of sending the whole iatt over the wire via setxattr, a structure called mdata_iatt is sent. The mdata_iatt contains only time attributes. Change-Id: I5e535631ddef04195361ae0364336410a2895dd4 fixes: bz#1593542 Signed-off-by: Kotresh HR <khiremat@redhat.com>