summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* 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 : add posix_set_ctime() in posix_ftruncate()Jiffin Tony Thottan2019-06-271-0/+2
| | | | | | Change-Id: I0cb5320fea71306e0283509ae47024f23874b53b fixes: bz#1723761 Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
* posix: modify storage.reserve option to take size and percentSheetal Pamecha2019-06-264-39/+39
| | | | | | | | | | | * 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>
* [RFC] change get_real_filename implementation to use ENOATTR instead of ENOENTMichael Adam2019-06-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | get_real_filename is implemented as a virtual extended attribute to help Samba implement the case-insensitive but case preserving SMB protocol more efficiently. It is implemented as a getxattr call on the parent directory with the virtual key of "get_real_filename:<entryname>" by looking for a spelling with different case for the provided file/dir name (<entryname>) and returning this correct spelling as a result if the entry is found. Originally (05aaec645a6262d431486eb5ac7cd702646cfcfb), the implementation used the ENOENT errno to return the authoritative answer that <entryname> does not exist in any case folding. Now this implementation is actually a violation or misuse of the defined API for the getxattr call which returns ENOENT for the case that the dir that the call is made against does not exist and ENOATTR (or the synonym ENODATA) for the case that the xattr does not exist. This was not a problem until the gluster fuse-bridge was changed to do map ENOENT to ESTALE in 59629f1da9dca670d5dcc6425f7f89b3e96b46bf, after which we the getxattr call for get_real_filename returned an ESTALE instead of ENOENT breaking the expectation in Samba. It is an independent problem that ESTALE should not leak out to user space but is intended to trigger retries between fuse and gluster. But nevertheless, the semantics seem to be incorrect here and should be changed. This patch changes the implementation of the get_real_filename virtual xattr to correctly return ENOATTR instead of ENOENT if the file/directory being looked up is not found. The Samba glusterfs_fuse vfs module which takes advantage of the get_real_filename over a fuse mount will receive a corresponding change to map ENOATTR to ENOENT. Without this change, it will still work correctly, but the performance optimization for nonexisting files is lost. On the other hand side, this change removes the distinction between the old not-implemented case and the implemented case. So Samba changed to treat ENOATTR like ENOENT will not work correctly any more against old servers that don't implement get_real_filename. I.e. existing files will be reported as non-existing Change-Id: I971b427ab8410636d5d201157d9af70e0d075b67 fixes: bz#1722977 Signed-off-by: Michael Adam <obnox@samba.org>
* posix/ctime: Fix ctime upgrade issueKotresh HR2019-06-211-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: On a EC volume, during upgrade from the older version where ctime feature is not enabled(or not present) to the newer version where the ctime feature is available (enabled default), the self heal hangs and doesn't complete. Cause: The ctime feature has both client side code (utime) and server side code (posix). The feature is driven from client. Only if the client side sets the time in the frame, should the server side sets the time attributes in xattr. But posix setattr/fseattr was not doing that. When one of the server nodes is updated, since ctime is enabled by default, it starts setting xattr on setattr/fseattr on the updated node/brick. On a EC volume the first two updated nodes(bricks) are not a problem because there are 4 other bricks with consistent data. However once the third brick is updated, the new attribute(mdata xattr) will cause an inconsistency on metadata on 3 bricks, which prevents the file to be repaired. Fix: Don't create mdata xattr with utimes/utimensat system call. Only update if already present. Change-Id: Ieacedecb8a738bb437283ef3e0f042fd49dc4c8c fixes: bz#1720201 Signed-off-by: Kotresh HR <khiremat@redhat.com>
* posix: fix crash in posix_cs_set_stateSusant Palai2019-06-202-3/+9
| | | | | | Fixes: bz#1721474 Change-Id: Ic2a53fa3d1e9e23424c6898e0986f80d52c5e3f6 Signed-off-by: Susant Palai <spalai@redhat.com>
* core: fedora 30 compiler warningsSheetalPamecha2019-06-181-1/+1
| | | | | | | | warning: ‘%s’ directive argument is null [-Wformat-overflow=] Change-Id: I69b8d47f0002c58b00d1cc947fac6f1c64e0b295 updates: bz#1193929 Signed-off-by: SheetalPamecha <spamecha@redhat.com>
* multiple files: another attempt to remove includesYaniv Kaul2019-06-1411-45/+9
| | | | | | | | | | | | | | | | | | 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>
* features/shard: Fix block-count accounting upon truncate to lower sizeKrutika Dhananjay2019-06-041-0/+9
| | | | | | | | | | | | | | | | | The way delta_blocks is computed in shard is incorrect, when a file is truncated to a lower size. The accounting only considers change in size of the last of the truncated shards. FIX: Get the block-count of each shard just before an unlink at posix in xdata. Their summation plus the change in size of last shard (from an actual truncate) is used to compute delta_blocks which is used in the xattrop for size update. Change-Id: I9128a192e9bf8c3c3a959e96b7400879d03d7c53 fixes: bz#1705884 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
* across: coverity fixesAmar Tumballi2019-06-031-0/+1
| | | | | | | | | | | | | | | * locks/posix.c: key was not freed in one of the cases. * locks/common.c: lock was being free'd out of context. * nfs/exports: handle case of missing free. * protocol/client: handle case of entry not freed. * storage/posix: handle possible case of double free CID: 1398628, 1400731, 1400732, 1400756, 1124796, 1325526 updates: bz#789278 Change-Id: Ieeaca890288bc4686355f6565f853dc8911344e8 Signed-off-by: Amar Tumballi <amarts@redhat.com> Signed-off-by: Sheetal Pamecha <spamecha@redhat.com>
* posix: add storage.reserve-size optionSheetal Pamecha2019-06-034-13/+47
| | | | | | | | | | | 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>
* cloudsync: Make readdirp return stat info of all the direntsAnuradha Talur2019-04-251-0/+2
| | | | | | | | | | | | | | | This change got missed while the initial changes were sent. Should have been a part of : https://review.gluster.org/#/c/glusterfs/+/21757/ Gist of the change: Function that fills in stat info for dirents is invoked in readdirp in posix when cloudsync populates xdata request with GF_CS_OBJECT_STATUS. Change-Id: Ide0c4e80afb74cd2120f74ba934ed40123152d69 updates: bz#1642168 Signed-off-by: Anuradha Talur <atalur@commvault.com>
* ctime: Fix log repeated logging during openKotresh HR2019-04-241-10/+5
| | | | | | | | | | | | The log "posix set mdata failed, No ctime" logged repeatedly after the fix [1]. Those could be internal fops. This patch fixes the same. [1] https://review.gluster.org/22540 fixes: bz#1701457 Change-Id: I42799a90b976982cedb0ca11fa224d555eb05650 Signed-off-by: Kotresh HR <khiremat@redhat.com>
* posix/ctime: Fix stat(time attributes) inconsistency during readdirpKotresh HR2019-04-152-26/+44
| | | | | | | | | | | | | | | | | | | | 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-104-15/+177
| | | | | | | | | | 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>