summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-snapshot.c
Commit message (Collapse)AuthorAgeFilesLines
* xlators: prefer libglusterfs time APIDmitry Antipov2020-09-071-1/+2
| | | | | | | | | | 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
* snapshot/ganesha: Modify ganesha export file while creating cloneMohammed Rafi KC2020-08-211-1/+66
| | | | | | | | | | | | | A snapshot clone is nothing but a volume, So if the ganesha is enabled for the parent volume, the clone should also have the ganesha enabled. This patch add clonename to the export file. Change-Id: I847f23e62036aee02fb9e6adbc868aec6455d86e Fixes: #1043 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> Signed-off-by: srijan-sivakumar <ssivakum@redhat.com>
* glusterd: additional log informationnik-redhat2020-06-291-8/+68
| | | | | | | | | | | | | | | Issue: Some of the functions didn't had sufficient logging of information in case of failure. Fix: Added log information in few functions in case of failure indicating the cause of such event. Change-Id: I301cf3a1c8d2c94505c6ae0d83072b0241c36d84 fixes: #874 Signed-off-by: nik-redhat <nladha@redhat.com>
* 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>
* glusterd/snapshot: Improve log message during snapshot cloneMohammed Rafi KC2020-05-221-0/+10
| | | | | | | | | | | While taking a snapshot clone, if the snapshot is not activated, th cli was returning that the bricks are down. This patch clearly print tha the error is due to the snapshot state. Change-Id: Ia840e6e071342e061ad38bf15e2e2ff2b0dacdfa Fixes: #1255 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
* multiple xlators: reduce key lengthYaniv Kaul2020-01-141-28/+28
| | | | | | | | | | | | | | | In many cases, we were freely allocating long keys with no need. Smaller char arrays are just fine almost anywhere, so just went ahead and looked where they we can use smaller ones. In some cases, annotated the functions as static and the prefixes passed as const as it was easier to read and understand. Where relevant, converted the dict functions to use known key length. Change-Id: I882ab33ea20d90b63278336cd1370c09ffdab7f2 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* multiple files: reduce minor work under RCU_READ_LOCKYaniv Kaul2019-08-051-1/+1
| | | | | | | | | 1. Try to unlock faster - in error paths. 2. Remove memory allocations - do them before the lock. Change-Id: I1e9ddd80b99de45ad0f557d62a5f28951dfd54c8 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* core: use more restrictive mode while creating the directoriesSanju Rakonde2019-07-231-5/+5
| | | | | | | fixes: bz#1724024 Change-Id: I539fb7248b2cfc037ec29f1413ea648f9ec21ef2 Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
* glusterd.h: remove unneeded macros or move them to their users.Yaniv Kaul2019-06-251-0/+15
| | | | | | | | | | Some macros were not used, so removed. Some macros were quite local, so moved to the respective users. Some macros simplified (removed an allocation here and there) Change-Id: Ifaf1aff15a78f105b1549ab8053378933b35df43 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* core: fedora 30 compiler warningsSheetalPamecha2019-06-181-3/+1
| | | | | | | | warning: ‘%s’ directive argument is null [-Wformat-overflow=] Change-Id: I69b8d47f0002c58b00d1cc947fac6f1c64e0b295 updates: bz#1193929 Signed-off-by: SheetalPamecha <spamecha@redhat.com>
* glusterd/tier: remove tier related code from glusterdHari Gowtham2019-05-271-140/+0
| | | | | | | | | | | | | The handler functions are pointed to dummy functions. The switch case handling for tier also have been moved to point default case to avoid issues, if reintroduced. The tier changes in DHT still remain as such. updates: bz#1693692 Change-Id: I80d80c9a3eb862b4440a36b31ae82b2e9d92e4dc Signed-off-by: Hari Gowtham <hgowtham@redhat.com>
* glusterd: remove glusterd_check_volume_exists() callAtin Mukherjee2019-04-111-1/+3
| | | | | | | | As the same functionality is covered in glusterd_volinfo_find Updates: bz#1193929 Change-Id: I2308c5fa9b2ca9edaa95f172d0bd914103808c36 Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
* libglusterfs: Move devel headers under glusterfs directoryShyamsundarR2018-12-051-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | 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>
* glusterd: perform rcu_read_lock/unlock() under cleanup_lock mutexSanju Rakonde2018-12-031-3/+3
| | | | | | | | | | | | | | Problem: glusterd should not try to acquire locks on any resources, when it already received a SIGTERM and cleanup is started. Otherwise we might hit segfault, since the thread which is going through cleanup path will be freeing up the resouces and some other thread might be trying to acquire locks on freed resources. Solution: perform rcu_read_lock/unlock() under cleanup_lock mutex. fixes: bz#1654270 Change-Id: I87a97cfe4f272f74f246d688660934638911ce54 Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
* mgmt/glusterd: NULL pointer dereferencing clang fixShwetha Acharya2018-09-251-0/+6
| | | | | | | | Added a condition check to resolve the issue Change-Id: I1954e91f7487c052caf5cf98c954d204242f0af9 Updates: bz#1622665 Signed-off-by: Shwetha Acharya <sacharya@redhat.com>
* Land part 2 of clang-format changesGluster Ant2018-09-121-9126/+8729
| | | | | Change-Id: Ia84cc24c8924e6d22d02ac15f611c10e26db99b4 Signed-off-by: Nigel Babu <nigelb@redhat.com>
* Some (mgmt) xlators: use dict_{setn|getn|deln|get_int32n|set_int32n|set_strn}Yaniv Kaul2018-09-091-366/+493
| | | | | | | | | | | | | | | | | | | | | In a previous patch (https://review.gluster.org/20769) we've added the key length to be passed to dict_* funcs, to remove the need to strlen() it. This patch moves some xlators to use it. - It also adds dict_get_int32n which was missing. - It also reduces the size of some key variables. They were set to 1024b or PATH_MAX, where sometimes 64 bytes were really enough. Please review carefully: 1. That I did not reduce some the size of the key variables too much. 2. That I did not mix up some keys. Compile-tested only! Change-Id: Ic729baf179f40e8d02bc2350491d4bb9b6934266 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* Multiple files: calloc -> mallocYaniv Kaul2018-09-041-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | xlators/storage/posix/src/posix-inode-fd-ops.c: xlators/storage/posix/src/posix-helpers.c: xlators/storage/bd/src/bd.c: xlators/protocol/client/src/client-lk.c: xlators/performance/quick-read/src/quick-read.c: xlators/performance/io-cache/src/page.c xlators/nfs/server/src/nfs3-helpers.c xlators/nfs/server/src/nfs-fops.c xlators/nfs/server/src/mount3udp_svc.c xlators/nfs/server/src/mount3.c xlators/mount/fuse/src/fuse-helpers.c xlators/mount/fuse/src/fuse-bridge.c xlators/mgmt/glusterd/src/glusterd-utils.c xlators/mgmt/glusterd/src/glusterd-syncop.h xlators/mgmt/glusterd/src/glusterd-snapshot.c xlators/mgmt/glusterd/src/glusterd-rpc-ops.c xlators/mgmt/glusterd/src/glusterd-replace-brick.c xlators/mgmt/glusterd/src/glusterd-op-sm.c xlators/mgmt/glusterd/src/glusterd-mgmt.c xlators/meta/src/subvolumes-dir.c xlators/meta/src/graph-dir.c xlators/features/trash/src/trash.c xlators/features/shard/src/shard.h xlators/features/shard/src/shard.c xlators/features/marker/src/marker-quota.c xlators/features/locks/src/common.c xlators/features/leases/src/leases-internal.c xlators/features/gfid-access/src/gfid-access.c xlators/features/cloudsync/src/cloudsync-plugins/src/cloudsyncs3/src/libcloudsyncs3.c xlators/features/bit-rot/src/bitd/bit-rot.c xlators/features/bit-rot/src/bitd/bit-rot-scrub.c bxlators/encryption/crypt/src/metadata.c xlators/encryption/crypt/src/crypt.c xlators/performance/md-cache/src/md-cache.c: Move to GF_MALLOC() instead of GF_CALLOC() when possible It doesn't make sense to calloc (allocate and clear) memory when the code right away fills that memory with data. It may be optimized by the compiler, or have a microscopic performance improvement. In some cases, also changed allocation size to be sizeof some struct or type instead of a pointer - easier to read. In some cases, removed redundant strlen() calls by saving the result into a variable. 1. Only done for the straightforward cases. There's room for improvement. 2. Please review carefully, especially for string allocation, with the terminating NULL string. Only compile-tested! .. and allocate memory as much as needed. xlators/nfs/server/src/mount3.c : Don't blindly allocate PATH_MAX, but strlen() the string and allocate appropriately. Also, align error messges. updates: bz#1193929 Original-Author: Yaniv Kaul <ykaul@redhat.com> Signed-off-by: Yaniv Kaul <ykaul@redhat.com> Signed-off-by: Yaniv Kaul <ykaul@redhat.com> Change-Id: Ibda6f33dd180b7f7694f20a12af1e9576fe197f5
* snapshot : fixed coverity issue in glusterd-snapshot.cSunny Kumar2018-08-291-78/+88
| | | | | | | | This patch fixes CID 1395253 and indentation. Change-Id: Iffcd992d3d49765c7e47b864724f83c7c5d57579 updates: bz#789278 Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
* glusterd: fix gcc warningsRavishankar N2018-08-211-31/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ...and also changed char array initialization to from {0,} to "". gcc version 8.1.1 20180712 (Red Hat 8.1.1-5) (GCC) on Fedora 28. Sample warnings: glusterd-utils.c:7234:41: warning: ‘.hostname’ directive output may be truncated writing 9 bytes into a region of size between 1 and 1024 [-Wformat-truncation=] snprintf (key, sizeof (key), "%s.hostname", base_key); ^~~~~~~~~ glusterd-utils.c:7234:9: note: ‘snprintf’ output between 10 and 1033 bytes into a destination of size 1024 snprintf (key, sizeof (key), "%s.hostname", base_key); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ glusterd-snapshot.c:3090:65: warning: ‘/’ directive output may be truncated writing 1 byte into a region of size between 0 and 4095 [-Wformat-truncation=] snprintf (snap_path, sizeof (snap_path) - 1, "%s/%s", ^ glusterd-snapshot.c:3090:17: note: ‘snprintf’ output between 2 and 4351 bytes into a destination of size 4095 snprintf (snap_path, sizeof (snap_path) - 1, "%s/%s", ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ snap_mount_dir, snap_vol->snapshot->snapname); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ glusterd-statedump.c:28:45: warning: ‘%s’ directive output may be truncated writing up to 4095 bytes into a region of size 144 [-Wformat-truncation=] snprintf (subkey, sizeof (subkey), "%s%d", key, index); ^~ ~~~ glusterd-statedump.c:28:9: note: ‘snprintf’ output between 2 and 4107 bytes into a destination of size 144 snprintf (subkey, sizeof (subkey), "%s%d", key, index); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ updates: bz#1193929 Change-Id: Ic721f27b28d1221c124b570e81c55528f5b7f3cd Signed-off-by: Ravishankar N <ravishankar@redhat.com>
* snapshot:Fix wrong dictionary key in snapshot cleanup codeMohammed Rafi KC2018-08-201-1/+2
| | | | | | | | | | | Snapshot was designed to support multiple volume snapshot, hence the volume name keys are labelled with volume count. So the volume key should have a volume count appended with key Change-Id: I044d73fc86db0e662dc914669aecfb82a6476fb5 fixes: bz#1618004 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
* snapshot:Fail snapshot creation if an empty description providedMohammed Rafi KC2018-08-191-0/+10
| | | | | | | | | | Snapshot description should have a valid string. Creating a snapshot with null value will cause reading from info file to fail with a null exception Change-Id: I9f84154b8e3e7ffefa5438807b3bb9b4e0d964ca updates: bz#1618004 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
* All: remove memset() before sprintf()Yaniv Kaul2018-08-141-1/+0
| | | | | | | | | | | | It's not needed. There's a good chance the compiler is smart enough to remove it anyway, but it can't hurt - I hope. Compile-tested only! Change-Id: Id7c054e146ba630227affa591007803f3046416b updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* glusterd: Add multiple checks before attach/start a brickMohit Agrawal2018-07-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: In brick mux scenario sometime glusterd is not able to start/attach a brick and gluster v status shows brick is already running Solution: 1) To make sure brick is running check brick_path in /proc/<pid>/fd , if a brick is consumed by the brick process it means brick stack is come up otherwise not 2) Before start/attach a brick check if a brick is mounted or not 3) At the time of printing volume status check brick is consumed by any brick process Test: To test the same followed procedure 1) Setup brick mux environment on a vm 2) Put a breaking point in gdb in function posix_health_check_thread_proc at the time of notify GF_EVENT_CHILD_DOWN event 3) unmount anyone brick path forcefully 4) check gluster v status it will show N/A for the brick 5) Try to start volume with force option, glusterd throw message "No device available for mount brick" 6) Mount the brick_root path 7) Try to start volume with force option 8) down brick is started successfully Change-Id: I91898dad21d082ebddd12aa0d1f7f0ed012bdf69 fixes: bz#1595320 Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
* All: run codespell on the code and fix issues.Yaniv Kaul2018-07-221-8/+8
| | | | | | | | | | | | Please review, it's not always just the comments that were fixed. I've had to revert of course all calls to creat() that were changed to create() ... Only compile-tested! Change-Id: I7d02e82d9766e272a7fd9cc68e51901d69e5aab5 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
* snapshot : remove stale entrySunny Kumar2018-07-121-0/+38
| | | | | | | | | | | During snap delete after removing brick-path we should remove snap-path too i.e. /var/run/gluster/snaps/<snap-name>. During snap deactivate also we should remove snap-path. Change-Id: Ib80b5d8844d6479d31beafa732e5671b0322248b fixes: bz#1597662 Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
* Fix compile warningsXavi Hernandez2018-07-101-56/+126
| | | | | | | | | | | This patch fixes compile warnings that appear with newer compilers. The solution applied is only to remove the warnings, but it doesn't always solve the problem in the best way. It assumes that the problem will never happen, as the previous code assumed. Change-Id: I6e8470d6c2e2dbd3bd7d324b5fd2f92ffdc3d6ec updates: bz#1193929 Signed-off-by: Xavi Hernandez <xhernandez@redhat.com>
* glusterd: show brick online after port registration even in brick-muxPranith Kumar K2018-07-051-1/+1
| | | | | | | | | | | | | | | | | Problem: With brick-mux even before brick attach is complete on the bricks glusterd marks them as online. This can lead to a race where scripts that check if the bricks are online to assume that the brick is online before it is completely online. Fix: Wait for the callback from the brick before marking the port as registered so that volume status will show the correct status of the brick. fixes bz#1597568 Change-Id: Icd3dc62506af0cf75195e96746695db823312051 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
* Don't use hardcoded /sbin, /usr/bin etc. paths. Fixes #1450546Niklas Hambüchen2018-05-031-2/+2
| | | | | | | | | Instead, rely on programs to be in PATH, as gluster already does in many places across its code base. Change-Id: Id21152fe42f5b67205d8f1571b0656c4d5f74246 BUG: 1450546 Signed-off-by: Niklas Hambuechen <mail@nh2.me>
* snapshot: fix several coverity issues in glusterd-snapshot.cSunny Kumar2017-12-211-19/+38
| | | | | | | | | | This patch fixes issues 157, 426, 428, 431, 432, 437,439, 482 from [1]. [1] https://download.gluster.org/pub/gluster/glusterfs/static-analysis/master/glusterfs-coverity/2017-12-13-e255385a/html/ Change-Id: Iff9df12bd9802db29434155badb1beda045aba5b BUG: 789278 Signed-off-by: Sunny Kumar <sunkumar@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>
* snapshot : fix coverity issue in glusterd-snapshot.cSunny Kumar2017-11-081-1/+3
| | | | | | | | | | This patch fixes coverity issue 87 from [1]. [1] https://download.gluster.org/pub/gluster/glusterfs/static-analysis/master/glusterfs-coverity/2017-10-30-9aa574a5/html/ Change-Id: I5c9c67b4dd43ebf1a5a83532cbd06178000da145 BUG: 789278 Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
* snapshot: lvm cleanup during snapshot removeSunny Kumar2017-11-081-7/+13
| | | | | | | | | | | Problem : During snapshot remove lvm cleanup was skipped for deactivated snapshots by assuming that its mount point is not present. Fix : Do no skip lvm cleanup by checking active mount point. Change-Id: I856d2d647c75db8b37b7f430277daef6eb7580a8 BUG: 1509254 Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
* snapshot: fix coverity issue 'DEADCODE'Sunny Kumar2017-10-311-11/+1
| | | | | | | | | | | | | | Problem : Unreachable code at glusterd-snapshot.c:6718 Unreachable code at glusterd-snapshot.c:7352 FIx : Remove unreachable code At glusterd-snapshot.c:6718 in if condition the value of "snap" must be "NULL" to call glusterd_snap_remove() which is not possible here. Change-Id: Id865bde7c1474a9b9ed11c0ed614676b4e2443c6 BUG: 789278 Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
* snapshot: Issue with other processes accessing the mounted brickSunny Kumar2017-10-231-34/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added code for unmount of activated snapshot brick during snapshot deactivation process which make sense as mount point for deactivated bricks should not exist. Removed code for mounting newly created snapshot, as newly created snapshots should not mount until it is activated. Added code for mount point creation and snapshot mount during snapshot activation. Added validation during glusterd init for mounting only those snapshot whose status is either STARTED or RESTORED. During snapshot restore, mount point for stopped snap should exist as it is required to set extended attribute. During handshake, after getting updates from friend mount point for activated snapshot should exist and should not for deactivated snapshot. While getting snap status we should show relevent information for deactivated snapshots, after this pathch 'gluster snap status' command will show output like- Snap Name : snap1 Snap UUID : snap-uuid Brick Path : server1:/run/gluster/snaps/snap-vol-name/brick Volume Group : N/A (Deactivated Snapshot) Brick Running : No Brick PID : N/A Data Percentage : N/A LV Size : N/A Fixes: #276 Change-Id: I65783488e35fac43632615ce1b8ff7b8e84834dc BUG: 1482023 Signed-off-by: Sunny Kumar <sunkumar@redhat.com>
* snapshot: clang compile warningSunny Kumar2017-09-041-1/+1
| | | | | | | | | | | | | | | | | | | | | Warning type: NO_EFFECT xlators/mgmt/glusterd/src/glusterd-snapshot.c:4004 : warning: comparison of constant -1 with expression of type 'gf_boolean_t' (aka 'enum _gf_boolean') is always false. solution : "timestamp" was formerly declared as gf_boolean_t, now changed to int. Change-Id: Ie461537f06fe2971e2b09a428a22331808c41a13 BUG: 1335251 Signed-off-by: Sunny Kumar <sunkumar@redhat.com> Reviewed-on: https://review.gluster.org/18062 Tested-by: Sunny Kumar Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Amar Tumballi <amarts@redhat.com> Reviewed-by: mohammed rafi kc <rkavunga@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
* glusterd: Make reset-brick work correctly if brick-mux is onSamikshan Bairagya2017-05-101-2/+0
| | | | | | | | | | | | | | | | | | | Reset brick currently kills of the corresponding brick process. However, with brick multiplexing enabled, stopping the brick process would render all bricks attached to it unavailable. To handle this correctly, we need to make sure that the brick process is terminated only if brick-multiplexing is disabled. Otherwise, we should send the GLUSTERD_BRICK_TERMINATE rpc to the respective brick process to detach the brick that is to be reset. Change-Id: I69002d66ffe6ec36ef48af09b66c522c6d35ac58 BUG: 1446172 Signed-off-by: Samikshan Bairagya <samikshan@gmail.com> Reviewed-on: https://review.gluster.org/17128 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
* glusterd: (storhaug) remove ganeshaKaleb S. KEITHLEY2017-03-211-96/+0
| | | | | | | | | | | | | | | | remove all vestiges of ganesha The storhaug CLI is used to manage ganesha and Samba. Also any setup and teardown of the ganesha HA is initiated using storhaug to preserve the proper layering. Change-Id: I0eec0016a1b7802a36e7b2d92896b86fdf8607d5 BUG: 1420713 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com> Reviewed-on: https://review.gluster.org/16504 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
* glusterd: use sys_lstat instead of lstatJeff Darcy2017-03-021-1/+1
| | | | | | | | | | | | | Showed up in 0symbol-check.t while testing something else. Might as well fix it now. Change-Id: Ic6b8214de6f486187afc4987c5ffbbca02c8997f Signed-off-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-on: https://review.gluster.org/16820 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Prashanth Pai <ppai@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
* Remove deadcode, found by covertyMichael Scherer2017-02-261-2/+0
| | | | | | | | | | | | | | | Since ret value is unchanged since last goto out, this code is unreachable. Change-Id: Iff8618739900b44bad6c4e663a4201d9e14cb457 BUG: 789278 Signed-off-by: Michael Scherer <misc@redhat.com> Reviewed-on: https://review.gluster.org/16713 Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> Tested-by: Michael Scherer <misc@fedoraproject.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
* core: run many bricks within one glusterfsd processJeff Darcy2017-01-301-33/+35
| | | | | | | | | | | | | | | | | | | | | | | This patch adds support for multiple brick translator stacks running in a single brick server process. This reduces our per-brick memory usage by approximately 3x, and our appetite for TCP ports even more. It also creates potential to avoid process/thread thrashing, and to improve QoS by scheduling more carefully across the bricks, but realizing that potential will require further work. Multiplexing is controlled by the "cluster.brick-multiplex" global option. By default it's off, and bricks are started in separate processes as before. If multiplexing is enabled, then *compatible* bricks (mostly those with the same transport options) will be started in the same process. Change-Id: I45059454e51d6f4cbb29a4953359c09a408695cb BUG: 1385758 Signed-off-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-on: https://review.gluster.org/14763 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
* snapshot: Fix restore rollback to reassign snap volume ids to bricksAvra Sengupta2016-12-161-0/+112
| | | | | | | | | | | | | | | | | | | | Added further checks to ensure we do not go beyond prevalidate when trying to restore a snapshot which has a nfs-gansha conf file, in a cluster when nfs-ganesha is not enabled The error message for the particular scenario is: "Snapshot(<snapname>) has a nfs-ganesha export conf file. cluster.enable-shared-storage and nfs-ganesha should be enabled before restoring this snapshot." Change-Id: I1b87e9907e0a5e162f26ef1ca89fe76e8da8610f BUG: 1404118 Signed-off-by: Avra Sengupta <asengupt@redhat.com> Reviewed-on: http://review.gluster.org/16116 Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
* snapshot: Fix the failure to recreate clones with same nameAvra Sengupta2016-11-011-14/+40
| | | | | | | | | | | | | | | | | | | The brick path of snapshot clones contained the clonename, thereby failing to create newer clones with the same name after the original clone had been deleted. This fix creates the brick path with the clone's vol id instead of the clones name. Hence future clones with the same name will not have the namespace clash. Change-Id: I262712adc576122f051b5d1ce171d020efaefd1a BUG: 1387160 Signed-off-by: Avra Sengupta <asengupt@redhat.com> Reviewed-on: http://review.gluster.org/15683 Smoke: Gluster Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
* snapshot: Fix for memory leaks in snapshot code pathAvra Sengupta2016-10-251-10/+28
| | | | | | | | | | | Change-Id: Idc2cb16574d166e3c0ee1f7c3a485f1acb19fc8c BUG: 1386088 Signed-off-by: Avra Sengupta <asengupt@redhat.com> Reviewed-on: http://review.gluster.org/15668 NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
* glusterd (snapshot): fix unused variable warnings/errorsKaleb S. KEITHLEY2016-09-121-22/+0
| | | | | | | | | | | | | | | | | http://review.gluster.org/14085 fixes a/the "leak" - via the generated rpc/xdr headers - of pragmas that mask these warnings. However 14085 won't pass the smoke test until all the warnings are fixed. Change-Id: I359145d9e726b0fae78cac8003b57c216780cbba BUG: 1369124 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.org/15278 NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
* snapshot/eventsapi: Integrate snapshot events with eventsapiAvra Sengupta2016-09-011-7/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. EVENT_SNAPSHOT_CREATED : snapshot_name=snap1 volume_name=test_vol snapshot_uuid=26dd6c52-6021-40b1-a507-001a80401d70 2. EVENT_SNAPSHOT_CREATE_FAILED : snapshot_name=snap1 volume_name=test_vol error=Snapshot snap1 already exists 3. EVENT_SNAPSHOT_ACTIVATED : snapshot_name=snap1 snapshot_uuid=26dd6c52-6021-40b1-a507-001a80401d70 4. EVENT_SNAPSHOT_ACTIVATE_FAILED: snapshot_name=snap1 error=Snapshot snap1 is already activated. 5. EVENT_SNAPSHOT_DEACTIVATED : snapshot_name=snap1 snapshot_uuid=26dd6c52-6021-40b1-a507-001a80401d70 6. EVENT_SNAPSHOT_DEACTIVATE_FAILED : snapshot_name=snap3 error=Snapshot (snap3) does not exist. 7. EVENT_SNAPSHOT_SOFT_LIMIT_REACHED : volume_name=test_vol volume_id=2ace2616-5591-4b9b-be2a-38592dda5758 8. EVENT_SNAPSHOT_HARD_LIMIT_REACHED : volume_name=test_vol volume_id=2ace2616-5591-4b9b-be2a-38592dda5758 9. EVENT_SNAPSHOT_RESTORED : snapshot_name=snap1 volume_name=test_vol snapshot_uuid=3a840ec5-08da-4f2b-850d-1d5539a5d14d 10. EVENT_SNAPSHOT_RESTORE_FAILED : snapshot_name=snap10 error=Snapshot (snap10) does not exist 11. EVENT_SNAPSHOT_DELETED : snapshot_name=snap1 snapshot_uuid=d9ff3d4f-f579-4345-a4da-4f9353f0950c 12. EVENT_SNAPSHOT_DELETE_FAILED : snapshot_name=snap2 error=Snapshot (snap2) does not exist 13. EVENT_SNAPSHOT_CLONED : clone_uuid=93ba9f06-cb9c-4ace-aa52-2616e7f31022 snapshot_name=snap1 clone_name=clone2 14. EVENT_SNAPSHOT_CLONE_FAILED : snapshot_name=snap1 clone_name=clone2 error=Volume with name:clone2 already exists 15. EVENT_SNAPSHOT_CONFIG_UPDATED : auto-delete=enable config_type=system_config config_type=volume_config hard_limit=100 16. EVENT_SNAPSHOT_CONFIG_UPDATE_FAILED : error=Invalid snap-max-soft-limit 110. Expected range 1 - 100 17. EVENT_SNAPSHOT_SCHEDULER_INITIALISED : status=Success 18. EVENT_SNAPSHOT_SCHEDULER_INIT_FAILED 19. EVENT_SNAPSHOT_SCHEDULER_ENABLED : status=Successfuly Enabled 20. EVENT_SNAPSHOT_SCHEDULER_ENABLE_FAILED : error=Snapshot scheduler is already enabled. 21. EVENT_SNAPSHOT_SCHEDULER_SCHEDULE_ADDED : status=Successfuly added job job1 22. EVENT_SNAPSHOT_SCHEDULER_SCHEDULE_ADD_FAILED : status=Failed to add job job1 error=The job already exists. 23. EVENT_SNAPSHOT_SCHEDULER_SCHEDULE_EDITED : status=Successfuly edited job job1 24. EVENT_SNAPSHOT_SCHEDULER_SCHEDULE_EDIT_FAILED : status=Failed to edit job job2 error=The job cannot be found. 25. EVENT_SNAPSHOT_SCHEDULER_SCHEDULE_DELETED : status=Successfuly deleted job job1 26. EVENT_SNAPSHOT_SCHEDULER_SCHEDULE_DELETE_FAILED : status=Failed to delete job job1 error=The job cannot be found. 27. EVENT_SNAPSHOT_SCHEDULER_DISABLED : status=Successfuly Disabled 28. EVENT_SNAPSHOT_SCHEDULER_DISABLE_FAILED : error=Snapshot scheduler is already disabled. Change-Id: I3479cc3fb7af3c76ded67cf289f99547d0a55d21 BUG: 1370567 Signed-off-by: Avra Sengupta <asengupt@redhat.com> Reviewed-on: http://review.gluster.org/15329 Tested-by: Aravinda VK <avishwan@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
* snapshot/cli: Fix snapshot status xml outputAvra Sengupta2016-08-231-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | snap status --xml errors out if a brick is down and doesn't have pid. It is handled in the cli of the snap status where "N/A" is displayed in such a scenario. Handled the same in xml snap status <snapname> --xml fails as the writer is not initialised for the same. Using GF_SNAP_STATUS_TYPE_ITER instead of GF_SNAP_STATUS_TYPE_SNAP for all snap's status to differentiate between the two scenarios. Added testcase volume-snapshot-xml.t to check all snapshot commands xml outputs Change-Id: I99563e8f3e84f1aaeabd865326bb825c44f5c745 BUG: 1325831 Signed-off-by: Avra Sengupta <asengupt@redhat.com> Reviewed-on: http://review.gluster.org/14018 Smoke: Gluster Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
* Snapshot/xml:xml output for snapshot cloneMohammed Rafi KC2016-07-291-1/+1
| | | | | | | | | | | | | | | | | | Snapshot clone is used to create a regular volume from snapshot. Currently snapshot clone is not supporting xml outout. This change introduce a xml output for snapshot clone command Change-Id: I417b480d36f9d84ee088004999b041c9619edd50 BUG: 1207604 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> Reviewed-on: http://review.gluster.org/10065 Reviewed-by: Avra Sengupta <asengupt@redhat.com> Tested-by: Avra Sengupta <asengupt@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
* glusterd/snapshot: free resource from the owner of memoryMohammed Rafi KC2016-06-141-22/+7
| | | | | | | | | | | | | | | | We are freeing memory from a function which is not the owner of the memory. Free should happen from the owner of resources. Change-Id: If8772ba27f9eb65881dcdddde8d7dc431c1c0ee8 BUG: 1341796 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> Reviewed-on: http://review.gluster.org/14634 NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
* glusterd/snapshot: remove quota related options from snap volfileMohammed Rafi KC2016-06-021-16/+137
| | | | | | | | | | | | | | | | | | | | enabling inode-quota on a snapshot volume is unnecessary, because snapshot is a read-only volume. So we don't need to enforce quota on a snapshot volume. This patch will remove the quota related options from snapshot volfile. Change-Id: Iddabcb83820dac2384924a01d45abe1ef1e95600 BUG: 1341796 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> Reviewed-on: http://review.gluster.org/14608 Reviewed-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-by: N Balachandran <nbalacha@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>