summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix/src/posix-helpers.c
Commit message (Collapse)AuthorAgeFilesLines
* xlators: prefer libglusterfs time APIDmitry Antipov2020-09-071-13/+10
| | | | | | | | | | Prefer timespec_now_realtime() and gf_time() over clock_gettime() and time(), use gf_tvdiff() and gf_tsdiff() where appropriate, drop unused time_elapsed() and leftovers in 'struct posix_private'. Change-Id: Ie1f0229df5b03d0862193ce2b7fb91d27b0981b6 Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Updates: #1002
* posix: Implement a janitor thread to close fdMohit Agrawal2020-08-201-0/+93
| | | | | | | | | | | | | | Problem: In the commit fb20713b380e1df8d7f9e9df96563be2f9144fd6 we use syntask to close fd but we have found the patch is reducing the performance Solution: Use janitor thread to close fd's and save the pfd ctx into ctx janitor list and also save the posix_xlator into pfd object to avoid the race condition during cleanup in brick_mux environment Change-Id: Ifb3d18a854b267333a3a9e39845bfefb83fbc092 Fixes: #1396 Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
* libglusterfs: add library wrapper for time()Dmitry Antipov2020-08-171-1/+1
| | | | | | | | | Add thin convenient library wrapper gf_time(), adjust related users and comments as well. Change-Id: If8969af2f45ee69c30c3406bce5baa8305fb7f80 Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Updates: #1002
* dht - fixing xattr inconsistencyBarak Sason Rofman2020-07-221-0/+19
| | | | | | | | | | | | | | | | | The scenario of setting an xattr to a dir, killing one of the bricks, removing the xattr, bringing back the brick results in xattr inconsistency - The downed brick will still have the xattr, but the rest won't. This patch add a mechanism that will remove the extra xattrs during lookup. This patch is a modification to a previous patch based on comments that were made after merge: https://review.gluster.org/#/c/glusterfs/+/24613/ fixes: #1324 Change-Id: Ifec0b7aea6cd40daa8b0319b881191cf83e031d1 Signed-off-by: Barak Sason Rofman <bsasonro@redhat.com>
* storage/posix, libglusterfs: library function to sync filesystemDmitry Antipov2020-06-221-17/+2
| | | | | | | | Convert an ad-hoc hack to a regular library function gf_syncfs(). Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Change-Id: I3ed93e9f28f22c273df1466ba4a458eacb8df395 Fixes: #1329
* Indicate timezone offsets in timestampsCsaba Henk2020-06-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Logs and other output carrying timestamps will have now timezone offsets indicated, eg.: [2020-03-12 07:01:05.584482 +0000] I [MSGID: 106143] [glusterd-pmap.c:388:pmap_registry_remove] 0-pmap: removing brick (null) on port 49153 To this end, - gf_time_fmt() now inserts timezone offset via %z strftime(3) template. - A new utility function has been added, gf_time_fmt_tv(), that takes a struct timeval pointer (*tv) instead of a time_t value to specify the time. If tv->tv_usec is negative, gf_time_fmt_tv(... tv ...) is equivalent to gf_time_fmt(... tv->tv_sec ...) Otherwise it also inserts tv->tv_usec to the formatted string. - Building timestamps of usec precision has been converted to gf_time_fmt_tv, which is necessary because the method of appending a period and the usec value to the end of the timestamp does not work if the timestamp has zone offset, but it's also beneficial in terms of eliminating repetition. - The buffer passed to gf_time_fmt/gf_time_fmt_tv has been unified to be of GF_TIMESTR_SIZE size (256). We need slightly larger buffer space to accommodate the zone offset and it's preferable to use a buffer which is undisputedly large enough. This change does *not* do the following: - Retaining a method of timestamp creation without timezone offset. As to my understanding we don't need such backward compatibility as the code just emits timestamps to logs and other diagnostic texts, and doesn't do any later processing on them that would rely on their format. An exception to this, ie. a case where timestamp is built for internal use, is graph.c:fill_uuid(). As far as I can see, what matters in that case is the uniqueness of the produced string, not the format. - Implementing a single-token (space free) timestamp format. While some timestamp formats used to be single-token, now all of them will include a space preceding the offset indicator. Again, I did not see a use case where this could be significant in terms of representation. - Moving the codebase to a single unified timestamp format and dropping the fmt argument of gf_time_fmt/gf_time_fmt_tv. While the gf_timefmt_FT format is almost ubiquitous, there are a few cases where different formats are used. I'm not convinced there is any reason to not use gf_timefmt_FT in those cases too, but I did not want to make a decision in this regard. Change-Id: I0af73ab5d490cca7ed8d07a2ce7ac22a6df2920a Updates: #837 Signed-off-by: Csaba Henk <csaba@redhat.com>
* When creating new file don't set xatrr "trusted.glusterfs.dht"Tamar Shacked2020-06-091-2/+4
| | | | | | | | | | The curr call to delete the xattr from the dict fails to find the key: dict_del_sizen(xdata, xattr_name); This is beacuse keysize is calculated as sizeof of xattr_name which is a pointer, this lead to wrong size -> hash. Fix: call to dict_deln which get keysize using strlen. fixes: #1282 Change-Id: I23ce1f8f7928e9daa43bc3a9fa8d3611e81bbc36 Signed-off-by: Tamar Shacked <tshacked@redhat.com>
* cluster/afr: Prioritize ENOSPC over other errorskarthik-us2020-06-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | Problem: In a replicate/arbiter volume if file creations or writes fails on quorum number of bricks and on one brick it is due to ENOSPC and on other brick it fails for a different reason, it may fail with errors other than ENOSPC in some cases. Fix: Prioritize ENOSPC over other lesser priority errors and do not set op_errno in posix_gfid_set if op_ret is 0 to avoid receiving any error_no which can be misinterpreted by __afr_dir_write_finalize(). Also removing the function afr_has_arbiter_fop_cbk_quorum() which might consider a successful reply form a single brick as quorum success in some cases, whereas we always need fop to be successful on quorum number of bricks in arbiter configuration. Change-Id: I106e267f8b9451f681022f1cccb410d9bc824c08 Fixes: #1254 Signed-off-by: karthik-us <ksubrahm@redhat.com>
* storage/posix: fix thread name to comply with common conventionDmitry Antipov2020-05-181-1/+1
| | | | | | | | | Rename disk space checking thread to comply with common convention, adjust related docs as well. Change-Id: I36d642cf09773a28abd95bbe337ce29134ad96a4 Signed-off-by: Dmitry Antipov <dmantipov@yandex.ru> Fixes: #1248
* 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>
* 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-201-98/+0
| | | | | | | | | | | | | | | 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>
* dht: Fix stale-layout and create issueSusant Palai2020-02-091-0/+76
| | | | | | | | | | | | | | | | | 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>
* multiple: fix bad type castXavi Hernandez2020-01-101-1/+2
| | | | | | | | | | | | 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: Improve MAKE_HANDLE_GFID_PATH and MAKE_HANDLE_RELPATHMohit Agrawal2019-11-111-1/+1
| | | | | | | | 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-061-32/+40
| | | | | | | | | | | | | | | | 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-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>
* 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-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>
* 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>
* ctime/rebalance: Heal ctime xattr on directory during rebalanceKotresh HR2019-09-161-4/+27
| | | | | | | | | | | | | | | | 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-051-13/+13
| | | | | | | | | 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>
* posix: In brick_mux brick is crashed while start/stop volume in loopMohit Agrawal2019-08-201-0/+16
| | | | | | | | | | | | | | | 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>
* 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>
* 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>
* Replace usleep() with nanosleep()Vijay Bellur2019-07-111-1/+1
| | | | | | | | | | | | | | | | | | | As usleep has been obsoleted, changed all invocations of usleep to nanosleep. From man 3 usleep: "4.3BSD, POSIX.1-2001. POSIX.1-2001 declares this function obsolete; use nanosleep(2) instead. POSIX.1-2008 removes the specification of usleep()." Added a helper function gf_nanosleep() to have a single place for handling edge cases that might arise from the conversion of usleep to nanosleep and allow the sleep to resume with right remaining value upon being interrupted. Fixes: bz#1721686 Change-Id: Ia39ab82c9e0f4669d2c00d4cdf25e38d94ef9f62 Signed-off-by: Vijay Bellur <vbellur@redhat.com>
* posix: fix Wformat-overflow warningSheetal Pamecha2019-07-091-2/+2
| | | | | | | | warning: ‘%s’ directive argument is null Change-Id: I2ce9560f98a8310886c31384e40c2e101ad2c719 updates: bz#1193929 Signed-off-by: Sheetal Pamecha <spamecha@redhat.com>
* posix: modify storage.reserve option to take size and percentSheetal Pamecha2019-06-261-13/+13
| | | | | | | | | | | * reverting changes made in https://review.gluster.org/#/c/glusterfs/+/21686/ * Now storage.reserve can take value in percent or bytes fixes: bz#1651445 Change-Id: Id4826210ec27991c55b17d1fecd90356bff3e036 Signed-off-by: Sheetal Pamecha <spamecha@redhat.com>
* posix: fix crash in posix_cs_set_stateSusant Palai2019-06-201-0/+5
| | | | | | Fixes: bz#1721474 Change-Id: Ic2a53fa3d1e9e23424c6898e0986f80d52c5e3f6 Signed-off-by: Susant Palai <spalai@redhat.com>
* multiple files: another attempt to remove includesYaniv Kaul2019-06-141-8/+0
| | | | | | | | | | | | | | | | | | There are many include statements that are not needed. A previous more ambitious attempt failed because of *BSD plafrom (see https://review.gluster.org/#/c/glusterfs/+/21929/ ) Now trying a more conservative reduction. It does not solve all circular deps that we have, but it does reduce some of them. There is just too much to handle reasonably (dht-common.h includes dht-lock.h which includes dht-common.h ...), but it does reduce the overall number of lines of include we need to look at in the future to understand and fix the mess later one. Change-Id: I550cd001bdefb8be0fe67632f783c0ef6bee3f9f updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* across: clang-scan: fix NULL dereferencing warningsAmar Tumballi2019-06-041-1/+1
| | | | | | | | | All these checks are done after analyzing clang-scan report produced by the CI job @ https://build.gluster.org/job/clang-scan updates: bz#1622665 Change-Id: I590305af4ceb779be952974b2a36066ffc4865ca Signed-off-by: Amar Tumballi <amarts@redhat.com>
* posix: add storage.reserve-size optionSheetal Pamecha2019-06-031-3/+10
| | | | | | | | | | | storage.reserve-size option will take size as input instead of percentage. If set, priority will be given to storage.reserve-size over storage.reserve. Default value of this option is 0. fixes: bz#1651445 Change-Id: I7a7342c68e436e8bf65bd39c567512ee04abbcea Signed-off-by: Sheetal Pamecha <sheetal.pamecha08@gmail.com>
* Fix some "Null pointer dereference" coverity issuesXavi Hernandez2019-05-261-0/+3
| | | | | | | | | | | | | | | | | | | | | | This patch fixes the following CID's: * 1124829 * 1274075 * 1274083 * 1274128 * 1274135 * 1274141 * 1274143 * 1274197 * 1274205 * 1274210 * 1274211 * 1288801 * 1398629 Change-Id: Ia7c86cfab3245b20777ffa296e1a59748040f558 Updates: bz#789278 Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
* storage/posix: fix fresh file detection delayXavier Hernandez2019-04-291-4/+20
| | | | | | | | | | | Current implementation made it possible to consider that a file was not fresh even if it was created less than a second ago. This patch fixes the way in which the delay is computed to ensure that at least one second has elapsed. Change-Id: I05f7b99e7e8dd97e31f7ebaaec6c39eecf98b00f Updates: bz#1193929 Signed-off-by: Xavier Hernandez <jahernan@redhat.com>
* posix/ctime: Fix stat(time attributes) inconsistency during readdirpKotresh HR2019-04-151-10/+19
| | | | | | | | | | | | | | | | | | | | Problem: Creation of tar file on gluster volume throws warning 'file changed as we read it' Cause: During readdirp, for few of the files whose inode is not present, time attributes were served from backend. This caused the ctime of few files to be different between before readdir and after readdir by tar. Solution: If ctime feature is enabled and inode is not present, don't serve the time attributes from backend file, serve it from xattr. fixes: bz#1698078 Change-Id: I427ef865f97399475faf5aa6ca495f7e317603ae Signed-off-by: Kotresh HR <khiremat@redhat.com>
* storage/posix: changes with respect to cloudsyncAnuradha Talur2019-04-101-0/+50
| | | | | | | | | | Main changes include logic to update iatt buf with file size from extended attributes in posix rather than having this logic in cloudsync xlator. Change-Id: I44f5f8df7a01e496372557fe2f4eff368dbdaa33 fixes: bz#1642168 Signed-off-by: Anuradha Talur <atalur@commvault.com>
* core: brick process is crashed at the time of spawn threadMohit Agrawal2019-01-111-6/+9
| | | | | | | | | | | | | Problem: brick is getting crashed at the time of calling pthread_detach after just call gf_thread_create.If sufficient resources are not available on the system pthread_create returns EAGAIN (non-negative) but the caller function expects negative error code in case of failure Solution: Change the condition in caller function to avoid the crash Change-Id: Ifeaa49f809957eb6c33aa9792f5af1b55566756d fixes: bz#1662906
* posix: buffer_size_warning coverity fixHarpreet Kaur2018-12-311-1/+1
| | | | | | | | | | | | | Defect: CID 1398469- Calling strncpy with a maximum size argument of 4096 bytes on destination array key of size 4096 bytes might leave the destination string unterminated. Fix: Using snprintf instead of strncpy. updates: bz#789278 Change-Id: I4fdcd0cbf3af8b2ded94603d92d1ceb4112284c4 Signed-off-by: Harpreet Kaur <hlalwani@redhat.com>
* all: handle string-overflow warnings of coverityAmar Tumballi2018-12-201-1/+1
| | | | | | updates: bz#789278 Change-Id: I7de800b90a614e3666e965b0cafc70026a844b2d Signed-off-by: Amar Tumballi <amarts@redhat.com>
* posix: use synctask for janitorPoornima G2018-12-191-45/+152
| | | | | | | | | | | | | | With brick mux, the number of threads increases as the number of bricks increases. As an initiative to reduce the number of threads in brick mux scenario, replacing janitor thread to use synctask infra. Now close() and closedir() handle by separate janitor thread which is linked with glusterfs_ctx. Updates #475 Change-Id: I0c4aaf728125ab7264442fde59f3d08542785f73 Signed-off-by: Poornima G <pgurusid@redhat.com>
* copy_file_range support in GlusterFSRaghavendra Bhat2018-12-121-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libglusterfs changes to add new fop * Fuse changes: - Changes in fuse bridge xlator to receive and send responses * posix changes to perform the op on the backend filesystem * protocol and rpc changes for sending and receiving the fop * gfapi changes for performing the fop * tools: glfs-copy-file-range tool for testing copy_file_range fop - Although, copy_file_range support has been added to the upstream fuse kernel module, no release has been made yet of a kernel which contains the support. It is expected to come in the upcoming release of linux-4.20 So, as of now, executing copy_file_range fop on a fused based filesystem results in fuse kernel module sending read on the source fd and write on the destination fd. Therefore a small gfapi based tool has been written to be able test the copy_file_range fop. This tool is similar (in functionality) to the example program given in copy_file_range man page. So, running regular copy_file_range on a fuse mount point and running gfapi based glfs-copy-file-range tool gives some idea about how fast, the copy_file_range (or reflink) can be. On the local machine this was the result obtained. mount -t glusterfs workstation:new /mnt/glusterfs [root@workstation ~]# cd /mnt/glusterfs/ [root@workstation glusterfs]# ls file [root@workstation glusterfs]# cd [root@workstation ~]# time /tmp/a.out /mnt/glusterfs/file /mnt/glusterfs/new real 0m6.495s user 0m0.000s sys 0m1.439s [root@workstation ~]# time glfs-copy-file-range $(hostname) new /tmp/glfs.log /file /rrr OPEN_SRC: opening /file is success OPEN_DST: opening /rrr is success FSTAT_SRC: fstat on /rrr is success copy_file_range successful real 0m0.309s user 0m0.039s sys 0m0.017s This tool needs following arguments 1) hostname 2) volume name 3) log file path 4) source file path (relative to the gluster volume root) 5) destination file path (relative to the gluster volume root) "glfs-copy-file-range <hostname> <volume> <log file path> <source> <destination>" - Added a testcase as well to run glfs-copy-file-range tool * io-stats changes to capture the fop for profiling * NOTE: - Added conditional check to see whether the copy_file_range syscall is available or not. If not, then return ENOSYS. - Added conditional check for kernel minor version in fuse_kernel.h and fuse-bridge while referring to copy_file_range. And the kernel minor version is kept as it is. i.e. 24. Increment it in future when there is a kernel release which contains the support for copy_file_range fop in fuse kernel module. * The document which contains a writeup on this enhancement can be found at https://docs.google.com/document/d/1BSILbXr_knynNwxSyyu503JoTz5QFM_4suNIh2WwrSc/edit Change-Id: I280069c814dd21ce6ec3be00a884fc24ab692367 updates: #536 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
* posix: posix_health_check_thread_proc crash due to priv is NULLMohit Agrawal2018-12-111-5/+3
| | | | | | | | | | | | | Problem: posix_fini sends a cancellation request to health_check thread and cleanup priv without ensuring health_check thread is running Solution: Make health_check && disk_space thread joinable and call gf_thread_cleanup_xint to wait unless thread is not finished Change-Id: I4d37b08138766881dab0922a47ed68a2c3411f13 fixes: bz#1636570 Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
* libglusterfs: Move devel headers under glusterfs directoryShyamsundarR2018-12-051-17/+17
| | | | | | | | | | | | | | | | | | | | | | | | libglusterfs devel package headers are referenced in code using include semantics for a program, this while it works can be better especially when dealing with out of tree xlator builds or in general out of tree devel package usage. Towards this, the following changes are done, - moved all devel headers under a glusterfs directory - Included these headers using system header notation <> in all code outside of libglusterfs - Included these headers using own program notation "" within libglusterfs This change although big, is just moving around the headers and making it correct when including these headers from other sources. This helps us correctly include libglusterfs includes without namespace conflicts. Change-Id: Id2a98854e671a7ee5d73be44da5ba1a74252423b Updates: bz#1193929 Signed-off-by: ShyamsundarR <srangana@redhat.com>
* posix: Null pointer dereferencing clang fixHarpreet Lalwani2018-10-261-1/+1
| | | | | | | | | Added a check for "top" Updates: bz#1622665 Change-Id: I354fdc7150b2f1eb452702ddb653e2d6ed609c10 Signed-off-by: Harpreet Lalwani <hlalwani@redhat.com>
* posix: fill glusterfs.posix.* acl xattrs at dictKinglong Mee2018-10-221-7/+83
| | | | | | Change-Id: I0730a037f96c4386c72ecf2f61c71ec17ffbc1b0 Updates: bz#1634220 Signed-off-by: Kinglong Mee <mijinlong@open-fs.com>