summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix/src/posix.h
Commit message (Collapse)AuthorAgeFilesLines
* xlators: prefer libglusterfs time APIDmitry Antipov2020-09-071-4/+0
| | | | | | | | | | 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-3/+6
| | | | | | | | | | | | | | 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>
* dht - fixing xattr inconsistencyBarak Sason Rofman2020-07-221-0/+3
| | | | | | | | | | | | | | | | | 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>
* Posix: Optimize posix code to improve file creationMohit Agrawal2020-04-061-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Posix: Use simple approach to close fdMohit Agrawal2020-03-201-3/+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>
* Posix: structs re-aligned and manual padding addedPurna Pavan Chandra Aekkaladevi2020-03-091-42/+48
| | | | | | | | | | | | 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-091-0/+4
| | | | | | | | | | | | | | | | | 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-211-6/+3
| | | | | | | | | | | 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: 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
* posix-entry-ops.c: remove some tier related codeYaniv Kaul2020-01-011-4/+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>
* posix: Improve MAKE_HANDLE_GFID_PATH and MAKE_HANDLE_RELPATHMohit Agrawal2019-11-111-0/+4
| | | | | | | | 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-3/+0
| | | | | | | | | | | | | | | | 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>
* ctime/rebalance: Heal ctime xattr on directory during rebalanceKotresh HR2019-09-161-2/+3
| | | | | | | | | | | | | | | | 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-1/+1
| | | | | | | | | 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: In brick_mux brick is crashed while start/stop volume in loopMohit Agrawal2019-08-201-0/+3
| | | | | | | | | | | | | | | 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>
* posix: modify storage.reserve option to take size and percentSheetal Pamecha2019-06-261-2/+2
| | | | | | | | | | | * 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>
* multiple files: another attempt to remove includesYaniv Kaul2019-06-141-2/+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>
* posix: add storage.reserve-size optionSheetal Pamecha2019-06-031-1/+2
| | | | | | | | | | | 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>
* storage/posix: changes with respect to cloudsyncAnuradha Talur2019-04-101-0/+2
| | | | | | | | | | 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>
* storage/posix: Remove nr_files usagePranith Kumar K2019-03-141-1/+0
| | | | | | | | | | | | | | | | nr_files is supposed to represent the number of files opened in posix. Present logic doesn't seem to handle anon-fds because of which the counts would always be wrong. I don't remember anyone using this value in debugging any problem probably because we always have 'ls -l /proc/<pid>/fd' which not only prints the fds that are active but also prints their paths. It also handles directories and anon-fds which actually opened the file. So removing this code instead of fixing the buggy logic to have the nr_files. fixes bz#1688106 Change-Id: Ibf8713fdfdc1ef094e08e6818152637206a54040 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
* posix: Convert several posix_private members to gf_atomicMohit Agrawal2019-01-151-3/+3
| | | | | | Change-Id: I629698d8ddf6f15428880bdc1501d36bc37b8ebb fixes: bz#1657607 Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
* core: brick process is crashed at the time of spawn threadMohit Agrawal2019-01-111-3/+3
| | | | | | | | | | | | | 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: use synctask for janitorPoornima G2018-12-191-7/+7
| | | | | | | | | | | | | | 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/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* libglusterfs: Move devel headers under glusterfs directoryShyamsundarR2018-12-051-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | 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: fill glusterfs.posix.* acl xattrs at dictKinglong Mee2018-10-221-2/+2
| | | | | | Change-Id: I0730a037f96c4386c72ecf2f61c71ec17ffbc1b0 Updates: bz#1634220 Signed-off-by: Kinglong Mee <mijinlong@open-fs.com>
* Land clang-format changesGluster Ant2018-09-121-395/+393
| | | | Change-Id: I6f5d8140a06f3c1b2d196849299f8d483028d33b
* posix: remove not supported get/set contentAmar Tumballi2018-09-041-4/+0
| | | | | | | | | | | | | | getting and setting a file's content using extended attribute worked great as a GET/PUT alternative when an object storage is supported on top of Gluster. But it needs application changes, and also, it skips some caching layers. It is not used over years, and not supported any more. Remove the dead code. Fixes: bz#1625102 Change-Id: Ide3b3f1f644f6ca58558bbe45561f346f96b95b7 Signed-off-by: Amar Tumballi <amarts@redhat.com>
* multiple xlators (storage/posix): strncpy()->sprintf(), reduce strlen()'sYaniv Kaul2018-08-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | xlators/storage/posix/src/posix-gfid-path.c xlators/storage/posix/src/posix-handle.c xlators/storage/posix/src/posix-helpers.c xlators/storage/posix/src/posix-inode-fd-ops.c xlators/storage/posix/src/posix.h strncpy may not be very efficient for short strings copied into a large buffer: If the length of src is less than n, strncpy() writes additional null bytes to dest to ensure that a total of n bytes are written. Instead, use snprintf(). Also: - save the result of strlen() and re-use it when possible. - move from strlen to SLEN (sizeof() ) for const strings. Compile-tested only! Change-Id: I056939f111a4ec6bc8ebd539ebcaf9eb67da6c95 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* posix: Delete the entry if gfid link creation failskarthik-us2018-08-201-1/+1
| | | | | | | | | | | | | | | Problem: If the gfid link file inside .glusterfs is not present for a file, the operations which are dependent on the gfid will fail, complaining the link file does not exists inside .glusterfs. Fix: If the link file creation fails, fail the entry creation operation and delete the original file. Change-Id: Id767511de2da46b1f45aea45cb68b98d965ac96d fixes: bz#1612037 Signed-off-by: karthik-us <ksubrahm@redhat.com>
* md-cache: Do not invalidate cache post set/remove xattrPoornima G2018-07-111-1/+1
| | | | | | | | | | | | | | | Since setxattr and removexattr fops cbk do not carry poststat, the stat cache was being invalidated in setxatr/remoxattr cbk. Hence the further lookup wouldn't be served from cache. To prevent this invalidation, md-cache is modified to get the poststat in set/removexattr_cbk in dict. Co-authored with Xavi Hernandez. Change-Id: I6b946be2d20b807e2578825743c25ba5927a60b4 fixes: bz#1586018 Signed-off-by: Xavi Hernandez <xhernandez@redhat.com> Signed-off-by: Poornima G <pgurusid@redhat.com>
* glusterd/ctime: Provide option to enable/disable ctime featureKotresh HR2018-05-061-0/+1
| | | | | | Updates: #208 Change-Id: If6f52b9b1b5b823ad64faeed662e96ceb848c54c Signed-off-by: Kotresh HR <khiremat@redhat.com>
* posix/ctime: posix hook to set ctime xattr in relevant fopsKotresh HR2018-05-061-2/+6
| | | | | | | | | | | This patch uses the ctime posix APIs to set consistent time across replica on disk. It also stores the time attributes in the inode context. Credits: Rafi KC <rkavunga@redhat.com> Updates: #208 Change-Id: I1a8d74d1e251f1d6d142f066fc99258025c0bcdd Signed-off-by: Kotresh HR <khiremat@redhat.com>
* posix/ctime: posix hooks to get consistent time xattrKotresh HR2018-05-061-5/+6
| | | | | | | | | | | | This patch uses the ctime posix APIs to get consistent time across replica. The time attributes are got from from inode context or from on disk if not found and merged with iatt to be returned. Credits: Rafi KC <rkavunga@redhat.com> Updates: #208 Change-Id: Id737038ce52468f1f5ebc8a42cbf9c6ffbd63850 Signed-off-by: Kotresh HR <khiremat@redhat.com>
* posix: APIs in posix to get and set time attributesKotresh HR2018-05-061-0/+17
| | | | | | | | | | | | | This is part of the effort to provide consistent time across distribute and replica set for time attributes (ctime, atime, mtime) of the object. This patch contains the APIs to set and get the attributes from on disk and in inode context. Credits: Rafi KC <rkavunga@redhat.com> Updates: #208 Change-Id: I5d3cba53eef90ac252cb8299c0da42ebab3bde9f Signed-off-by: Kotresh HR <khiremat@redhat.com>
* posix: check file state before continuing with fopsSusant Palai2018-04-101-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In context of Cloudsync: In scenarios where a data modification fop e.g. a write landed in POSIX thinking that the file is local, while the file was actually remote, can be dangerous. Ofcourse we don’t want to take inodelk for every read/write operation to check the archival status or coordinate with an upload or a download of a file. To avoid inodelk, we will check the status of the file in POSIX it self, before we resume the fop. This helps us avoiding any races mentioned above. Now e.g. if a write reached POSIX for a file which was actually remote, it can check the status of the file and will get to know that the file is remote. It can error out with this status “remote” and cloudsync xlator will retry the same operation, once it finished downloading the file. This patch includes the setxattr changes to do the post processing of upload i.e. truncate and setting the remote xattr "trusted.glusterfs.cs.remote" to indicate the file is REMOTE Each file will have no xattr if the file is LOCAL, one remote xattr if the file is REMOTE and a combination of REMOTE and DOWNLOADING xattr if the file is getting downloaded. There is healing logic of these xattrs to recover from crash inconsitencies. Fixes: #387 Change-Id: Ie93c2d41aa8d6a798a39bdbef9d1669f057e5fdb Signed-off-by: Susant Palai <spalai@redhat.com>
* posix/afr: handle backward compatibility for rchecksum fopRavishankar N2018-02-191-0/+2
| | | | | | | | | Added a volume option 'fips-mode-rchecksum' tied to op version 4. If not set, rchecksum fop will use MD5 instead of SHA256. updates: #230 Change-Id: Id8ea1303777e6450852c0bc25503cda341a6aec2 Signed-off-by: Ravishankar N <ravishankar@redhat.com>
* Posix: Implement put fopPoornima G2018-02-121-0/+6
| | | | | | Updates #353 Change-Id: I1410222529ff42a810d62825bd6eebe8913fad1e Signed-off-by: Poornima G <pgurusid@redhat.com>
* posix: In getxattr, honor the wildcard '*'Poornima G2018-01-191-0/+2
| | | | | | | | | | | | | | | | | Currently, the posix_xattr_fill performas a sys_getxattr on all the keys requested, there are requirements where the keys could contain a wildcard, in which case sys_getxattr would return ENODATA, eg: if the xattr requested is user.* all the xattrs with prefix user. should be returned, with their values. This patch, changes posix_xattr_fill, to honor wildcard in the keys requested. Updates #297 Change-Id: I3d52da2957ac386fca3c156e26ff4cdf0b2c79a9 Signed-off-by: Poornima G <pgurusid@redhat.com>
* dict: add more types for valuesAmar Tumballi2018-01-051-2/+2
| | | | | | | | | | Added 2 more types which are present in gluster codebase, mainly IATT and UUID. Updates #203 Change-Id: Ib6d6d6aefb88c3494fbf93dcbe08d9979484968f Signed-off-by: Amar Tumballi <amarts@redhat.com>
* cluster/dht: Add migration checks to dht_(f)xattropN Balachandran2017-12-261-0/+3
| | | | | | | | | | | | The dht_(f)xattrop implementation did not implement migration phase1/phase2 checks which could cause issues with rebalance on sharded volumes. This does not solve the issue where fops may reach the target out of order. Change-Id: I2416fc35115e60659e35b4b717fd51f20746586c BUG: 1471031 Signed-off-by: N Balachandran <nbalacha@redhat.com>
* posix: Add option to disable nftw() based deletes when purging the landfill ↵Shreyas Siravara2017-12-111-0/+3
| | | | | | | | | | | | | | | | directory Summary: - We may have found an issue where certain directories were being moved into .landfill and then being quickly purged via nftw(). - We would like to have an emergency option to disable these purges. > Reviewed-on: https://review.gluster.org/18253 > Reviewed-by: Shreyas Siravara <sshreyas@fb.com> Fixes #371 Change-Id: I90b54c535930c1ca2925a928728199b6b80eadd9 Signed-off-by: Amar Tumballi <amarts@redhat.com>
* storage/posix: Add limit to number of hard linksShreyas Siravara2017-12-081-0/+1
| | | | | | | | | | | | Summary: Too may hard links blow up btrfs by exceeding max xattr size (recordign pgfid for each hardlink). Add a limit to prevent this explosion. > Reviewed-on: https://review.gluster.org/18232 > Reviewed-by: Shreyas Siravara <sshreyas@fb.com> Fixes gluster/glusterfs#370 Signed-off-by: ShyamsundarR <srangana@redhat.com> Change-Id: I614a247834fb8f2b2743c0c67d11cefafff0dbaa
* posix: Reorganize posix xlator to prepare for reuse with rioShyamsundarR2017-12-021-0/+243
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Split out entry and inode/fd based FOPs into separate files from posix.c 2. Split out common routines (init, fini, reconf, and such) into its own file, from posix.c 3. Retain just the method assignments in posix.c (such that posix2 for RIO can assign its own methods in the future for entry operations and such) 4. Based on the split in (1) and (2) split out posix-handle.h into 2 files, such that macros that are needed for inode ops are in one and rest are in the other If the split is done as above, posix2 can compile with its own entry ops, and hence not compile, the entry ops as split in (1) above. The split described in (4) can again help posix2 to define its own macros to make entry and inode handles, thus not impact existing POSIX xlator code. Noted problems - There are path references in certain cases where quota is used (in the xattr FOPs), and thus will fail on reuse in posix2, this needs to be handled when we get there. - posix_init does set root GFID on the brick root, and this is incorrect for posix2, again will need handling later when posix2 evolves based on this code (other init checks seem fine on current inspection) Merge of experimental branch patches with the following gerrit change-IDs > Change-Id: I965ce6dffe70a62c697f790f3438559520e0af20 > Change-Id: I089a4d9cf470c2f9c121611e8ef18dea92b2be70 > Change-Id: I2cec103f6ba8f3084443f3066bcc70b2f5ecb49a Fixes gluster/glusterfs#327 Change-Id: I0ccfa78559a7c5a68f5e861e144cf856f5c9e19c Signed-off-by: ShyamsundarR <srangana@redhat.com>
* storage/posix : options to override umaskSubha sree Mohankumar2017-12-021-0/+7
| | | | | | | | | | | | | | | | | | | | | Options "create-mask" and "create-directory-mask" are added to remove the mode bits set on a file or directory when its created. Default value of these options is 0777. Options "force-create-mode" and "force-create-directory" sets the default permission for a file or directory irrespective of the clients umask. Default value of these options is 0000. Command to set option: volume set <volume name> storage.<option-name> <value> The valid value range from 0000 to 0777. Updates #301 Change-Id: Ia33d13f2117202ca55a056c747ccc3674eb8bae1 Signed-off-by: Subha sree Mohankumar <smohanku@redhat.com>
* posix: Convert posix_fs_health_check asynchrnously to save timestampMohit Agrawal2017-12-011-0/+2
| | | | | | | | | | | Problem: Sometime posix_fs_health_check thread is blocked on write/read call while backend device deleted abruptly. Solution: To resolve it convert code to update timestamp asynchrnously. BUG: 1501132 Change-Id: Id68ea6a572bf68fbf437e1d9be5221b63d47ff9c Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
* posix: Fix coverity issues in several posix functionsMohit Agrawal2017-11-291-0/+3
| | | | | | | | | | | | | | Fixes issues 528, 763, 778, 792, 793, 86, 28, 29, 30, 39, 42, 769, 783, 794, 795 from the report at [1]. [1]: https://download.gluster.org/pub/gluster/glusterfs/static-analysis/master/glusterfs-coverity/2017-10-30-9aa574a5/html/ Note: Apart from coverity resolve other issues in posix_get(f)xattr more cleaner way. BUG: 789278 Change-Id: If0737492198481ad7a8d75a3801c862fd61b8c6e Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
* Coverity Issue: PW.INCLUDE_RECURSION in several filesGirjesh Rajoria2017-11-091-1/+0
| | | | | | | | | | | | | | Coverity ID: 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 423, 424, 425, 426, 427, 428, 429, 436, 437, 438, 439, 440, 441, 442, 443 Issue: Event include_recursion Removed redundant, recursive includes from the files. Change-Id: I920776b1fa089a2d4917ca722d0075a9239911a7 BUG: 789278 Signed-off-by: Girjesh Rajoria <grajoria@redhat.com>
* posix: Ignore disk space reserve check for internal FOPSMohit Agrawal2017-10-301-3/+5
| | | | | | | | | | | | | Problem: Currently disk space reserve check is applicable for internal FOP also it needs to be ignore for internal FOP. Solution: Update the DISK_SPACE_CHECK_AND_GOTO macro at posix component. Macro will call only while key "GLUSTERFS_INTERNAL_FOP_KEY" exists in xdata. BUG: 1506083 Change-Id: I2b0840bbf4fa14bc247855b024ca136773d68d16 Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
* posix: add null gfid checksRavishankar N2017-08-081-0/+29
| | | | | | | | | | | | | | | | | | ...in file/dir creation and lookup codepaths. The check is relaxed for fops coming from trash xlator at the moment until trash has client side logic to send the create fops with gfid-req. Also fixed the missing trash pid assignment in creates sent by trash xlator. Without this, truncated files won't be moved to .trashcan. Change-Id: Ieddd7f0634850e7c7010e4fbb4ad1eead35888c8 BUG: 1478297 Signed-off-by: Ravishankar N <ravishankar@redhat.com> Reviewed-on: https://review.gluster.org/17975 Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: jiffin tony Thottan <jthottan@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>