summaryrefslogtreecommitdiffstats
path: root/xlators
Commit message (Collapse)AuthorAgeFilesLines
* storage/posix: implement native linux AIO supportAnand Avati2012-07-148-6/+657
| | | | | | | | | | | Configurable via cli with "storage.linux-aio" settable option Change-Id: I9929e0d6fc1bbc2a0fe1fb67bfc8d15d8a483d3f BUG: 837495 Signed-off-by: Anand Avati <avati@redhat.com> Reviewed-on: http://review.gluster.com/3627 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com>
* gsyncd: don't dereference NULL upon failed reallocJim Meyering2012-07-131-1/+1
| | | | | | | | | | | | Fix typo: s/buf/*buf/ in test for failed *buf = realloc... Spotted by coverity. Change-Id: Ie1db59956e331c3691f4ed470a3fbaf2bd2e2055 BUG: 789278 Signed-off-by: Jim Meyering <meyering@redhat.com> Reviewed-on: http://review.gluster.com/3669 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* remove useless if-before-free (and free-like) functionsJim Meyering2012-07-1379-1136/+560
| | | | | | | | | | | | See comments in http://bugzilla.redhat.com/839925 for the code to perform this change. Signed-off-by: Jim Meyering <meyering@redhat.com> BUG: 839925 Change-Id: I10e4ecff16c3749fe17c2831c516737e08a3205a Reviewed-on: http://review.gluster.com/3661 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* no semantic change: reverse condition and if/else clauses...Jim Meyering2012-07-131-3/+3
| | | | | | | | | | | | | Reverse an if-condition and the corresponding then/else code blocks to hide a false-positive if-before-GF_FREE from the useless-if-before-free script. Signed-off-by: Jim Meyering <meyering@redhat.com> BUG: 839925 Change-Id: Ia68558218d63ae77b6c1c85e15231b66cce5bd49 Reviewed-on: http://review.gluster.com/3651 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* fuse/md-cache: add support for the 'fopen-keep-cache' mount optionBrian Foster2012-07-135-21/+145
| | | | | | | | | | | | | | | | | | | | | | fopen-keep-cache disables unconditional page-cache invalidations on file open in fuse (via FOPEN_KEEP_CACHE) and replaces that behavior with detection of remote changes and explicit invalidations from mount/fuse. This option improves local caching through the page cache and native client. This change defines a new 'invalidate' translator callback to identify when an inode's cache mapping has been determined to be invalid. md-cache implements the policy to detect and invoke inode invalidations. fuse-bridge and io-cache implement invalidate handlers to invalidate the respective caches (page cache in the case of fuse). BUG: 833564 Change-Id: I99818da5777eaf06276c1c0b194669f5bab92d48 Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-on: http://review.gluster.com/3584 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* protocol/server: return 'xdata' even in case of errorAmar Tumballi2012-07-121-126/+133
| | | | | | | | | | | | | helps to better utilize dict for more clarity on errors, if required. Change-Id: I3ff90e16be946e5f60974d4bde68a729d596c9de Signed-off-by: Amar Tumballi <amarts@redhat.com> BUG: 826982 Reviewed-on: http://review.gluster.com/3633 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-by: Anand Avati <avati@redhat.com>
* core: remove the unused files - round 2Amar Tumballi2012-07-126-6034/+0
| | | | | | | | | BUG: 764890 Change-Id: I3eb626eeaa2a09f0e248444f560c2a0eaf46c642 Signed-off-by: Amar Tumballi <amarts@redhat.com> Reviewed-on: http://review.gluster.com/3660 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* rpc: variable name changesAmar Tumballi2012-07-128-347/+347
| | | | | | | | | | | | | 's/3_1/3_3/g' in case of glusterfs protocol 's/3_1_/_/g' in case of CLI and mgmt protocol Change-Id: I6e6510d02c05f68f290c52ed284c04576326e12c Signed-off-by: Amar Tumballi <amarts@redhat.com> BUG: 764890 Reviewed-on: http://review.gluster.com/3632 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-by: Anand Avati <avati@redhat.com>
* calls to dict_allocate_and_serialize() are not 64-bit cleanKaleb S. KEITHLEY2012-07-124-26/+20
| | | | | | | | | | | | | | | | | | | | | | | All calls to dict_allocate_and_serialize() pass the address of a 32-bit type, but must cast it to the 64-bit pointer type (size_t *). This happens to work on LE machines, but even if it's apparently benign, it's still a bug. On BE machines it is not benign. GF_PROTOCOL_DICT_SERIALIZE() hacks around it by creating a size_t temp var, but that's, well, a hack, IMO when you consider that all the callers are actually passing &<u_int>; the param should just be a u_int * and eliminate the buggy casts and the temp var in the macro. Nobody apparently uses the Fedora/EPEL PPC RPMs, but they might. People are trying to build gluster.org bits on SPARC and tripping over this. Change-Id: I92ea139f9e3e91ddbbb32a51b96fa582a9515626 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com> BUG: 838928 Reviewed-on: http://review.gluster.com/3642 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* geo-rep: don't let unexpected status provoke undefined behaviorJim Meyering2012-07-121-5/+10
| | | | | | | | | | | | | | | | | | | | glusterd_gsync_read_frm_status reads what is expected to be a NUL- terminated status string from the specified file, but makes two mistakes when trying to do the favor of trimming trailing spaces. Do not let a leading NUL byte of status cause us to read buf[-1] and possibly to clear that and any preceding "trailing" spaces. Do not let a blen-byte input (with no NUL byte) cause our use of strlen to access beyond the end of non-NUL-terminated buffer. I looked at this code because coverity reported that it was assuming a read-provided buffer to be NUL-terminated. Change-Id: I140be0948e31196e5be08766d4e6400bf6f4dfa1 BUG: 789278 Signed-off-by: Jim Meyering <meyering@redhat.com> Reviewed-on: http://review.gluster.com/3647 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* storage/posix: handle getxattr failures gracefullyRaghavendra Bhat2012-07-112-7/+61
| | | | | | | | | | | | | | Use proper variable types for getting return value of getxattr calls, which otherwise can lead to segfaulting of processes or page allocation failures in the kernel. Change-Id: I62ab5d6c378447090c19846f03298c3afc8863ba BUG: 838195 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-on: http://review.gluster.com/3640 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com> Reviewed-by: Anand Avati <avati@redhat.com>
* gsyncd: don't let a bogus config file make us read/write buf[-1]Jim Meyering2012-07-111-2/+4
| | | | | | | | | Change-Id: Ic55c28c572c1878f8a223ae2fd25d301a7ef0c12 BUG: 789278 Signed-off-by: Jim Meyering <meyering@redhat.com> Reviewed-on: http://review.gluster.com/3596 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* glusterd: avoid buffer overrun for over-long volnameJim Meyering2012-07-111-1/+7
| | | | | | | | | | | | | | | | | [in glusterd_store_is_valid_brickpath] When strlen(volname) is no smaller than sizeof(volinfo->volname), volinfo->volname would end up not being NUL-terminated. Then, a use of that buffer that expects it to be NUL-terminated (i.e., glusterd_store_brickinfopath_set's GLUSTERD_GET_BRICK_DIR) will access beyond the end of the buffer. Instead, diagnose the too-long volume name and fail. Change-Id: I655d8638547bf342d33280c14ff1edacc3cdeb5a BUG: 789278 Signed-off-by: Jim Meyering <meyering@redhat.com> Reviewed-on: http://review.gluster.com/3591 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* nfs-common: don't let 0-length path cause buf[-1] accessJim Meyering2012-07-111-2/+2
| | | | | | | | | Change-Id: I5f0e93448a954aff1ff08a0980fb9bfd60e63988 BUG: 789278 Signed-off-by: Jim Meyering <meyering@redhat.com> Reviewed-on: http://review.gluster.com/3594 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* xlator options: remove overwritten data-self-heal initializerJim Meyering2012-07-111-1/+0
| | | | | | | | | | | | | In the struct volume_options, the "data-self-heal" .default_value = "" setting appeared before a setting of .default_value = "on". Remove the former. Change-Id: Ieddcc18f61581f9448d806cd8bf8eefaaf0118b9 BUG: 789278 Signed-off-by: Jim Meyering <meyering@redhat.com> Reviewed-on: http://review.gluster.com/3589 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* rpc: add extra arguments to _callback's actor functionAmar Tumballi2012-07-112-4/+5
| | | | | | | | | | | | | Need to differentiate the callback functions based on which rpc-clnt the callback is received. without it, all callback actor handling will be like global. BUG: 839345 Change-Id: Ide024f5585eab3c5fe6c3b33250772fb6e8ad655 Signed-off-by: Amar Tumballi <amarts@redhat.com> Reviewed-on: http://review.gluster.com/3656 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* core: remove unused codeAmar Tumballi2012-07-1146-29721/+0
| | | | | | | | | BUG: 764890 Change-Id: Ia8bcaa7a4daeb706bcb0bba24b2e634e9ca20d49 Signed-off-by: Amar Tumballi <amarts@redhat.com> Reviewed-on: http://review.gluster.com/3657 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* xlators/protocol: better filenameAmar Tumballi2012-07-044-3/+4
| | | | | | | | | | | | | | 3_1 name was used for very first version of GlusterFS which used RPC for its protocol, even though we changed protocol after 3.1.x, we kept the name of few files as is. Changed the file names to something better. Change-Id: I297f1979e7c7e909e60674eec2e632506bc776f5 BUG: 764890 Signed-off-by: Amar Tumballi <amarts@redhat.com> Reviewed-on: http://review.gluster.com/3628 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* md-cache: cache SELinux and Posix ACL xattrs only if enabledAnand Avati2012-07-041-5/+56
| | | | | | | | | | | | | | Fetch and cache SELinux and Posix ACL extended attributes only if they are enabled in the command line respectively. Fetching the extra extended attributes is pointless and negatively impacts performance Change-Id: I1bd1dbb1abb4a6929fad5f78bbfeaab8542ab4e2 BUG: 765785 Signed-off-by: Anand Avati <avati@redhat.com> Reviewed-on: http://review.gluster.com/3538 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com>
* glusterd: copy /etc/glusterd to /var/lib and remove /etc/glusterd instead ofRaghavendra Bhat2012-07-041-1/+1
| | | | | | | | | | | | | | moving * Change default directory from /etc/glusterd to /var/lib/glusterd Change-Id: Iefa82e4fdb94ce5a84dfb40855c80e16e9ffcc40 BUG: 830218 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-on: http://review.gluster.com/3548 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-by: Anand Avati <avati@redhat.com>
* nfs: make NFS filehandles deterministicAnand Avati2012-07-042-151/+6
| | | | | | | | | | | | | The NFS3 file handles now includes just the bare minimum of (ident, exportid, gfid) and removes legacy 'variable' members which are unnecessary since the introduction of GFID backend Change-Id: Iff6e4435d170074b18d208742b48e79b130e2a4d BUG: 835336 Signed-off-by: Anand Avati <avati@redhat.com> Reviewed-on: http://review.gluster.com/3616 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com>
* cluster/afr: post-op-delay supportAnand Avati2012-07-046-2/+175
| | | | | | | | | | | | | | | | post-op-delay introduces an artificial delay between the OP and POST-OP-CHANGELOG phases of a write transaction to increase the probability of changelog-piggyback and eager-locking to work more efficiently. Also enable eager-locking by default. Change-Id: I865ca4b68512c44818719c7e388952f15d53e6c2 BUG: 836033 Signed-off-by: Anand Avati <avati@redhat.com> Reviewed-on: http://review.gluster.com/3621 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Pranith Kumar Karampuri <pranithk@gluster.com>
* cluster/afr: cleanup lk_owner and PID messAnand Avati2012-07-043-41/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Historically PID (frame->root->pid) was used by the locks translator to identify a locker (and make decisions about which locks contend or cooperate/merge). Since the introduction of lock_owner parameter the usage of PID (for locks) was deprecated and is now unused. This patch nukes the usage of PID in AFR The usage of lk_owner has also ended up being a mess, because of the differentiation required between ->lk() and ->inodelk(), (->lk() needs to be identified by the process (roughly) and ->inodelk() needs to be identified by the transaction) and also because of optimizations like eager locking (locks are no more identified by the transaction as they now get inherited by the next transaction). The scheme (and technique) now is: - All FOPs (the third phase of the transaction) happen with the lk_owner which is set by the topmost layer (FUSE, NFS etc.) - All entrylks are issued with lk_owner set to the frame->root address. - Inodelks which will not be subject to eager locking are issued with lk_owner set to frame->root. - Inodelks which are subject to eager locking are issued with lk_owner set to the address of fd_t (which are the only type of frames which get subject to the eager locking optimization) - At the start of the transaction, the transaction frame's lk_owner is set to the either frame->root or fd_t (and never unmodified) depending on the type of transaction. - Just before the third phase (FOP phase) the set lk_owner is "saved" away and overwritten by the lk_owner submitted by the top layer (FUSE or NFS) - Right after the third phase, the saved lk_owner is "restored" to resume the transaction into the POST-OP and eventually UNLOCK using the same lk_owner which was used during the LOCK phase. Change-Id: I6ab8e4d6b65ae4185fa85ad3fded8e9188b2f929 BUG: 836033 Signed-off-by: Anand Avati <avati@redhat.com> Reviewed-on: http://review.gluster.com/3620 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Pranith Kumar Karampuri <pranithk@gluster.com>
* cluster/afr: add a new option to select read-subvol by indexJeff Darcy2012-07-032-0/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | read subvolume is a nice option to set prefred read child if you have a replication over 2 datacenter. if you have 2 datacenter and have a distributed replication where one set of servers are in datacenter one and the other (the replicated) are in the other datacenter read-subvolume it not very handy since it goes over name and the subvolume name is different for each replication pair. i added a new option called read-subvolume-index which take the number of the subvolume to choose. 0 fo first , 1 for second and so on subvolume in every replication. this option can now be used in the --xlator-option mount option to choose the prefered read child for all replication at once. For Example on all clients in datacenter one you can use --xlator-option=volumename-replication-*.read-subvolume-index=0 to prefer read from the servers in datacenter one. when you expand or shrink the volume no changes are needed to the client config since the wildcard will set this option automatic on reconfigure. Change-Id: I3b47432f77037c380ff4a6296636c6f8fc953db9 BUG: 837420 Original-author: domwo <glusterfs@wollina.de> Signed-off-by: domwo <glusterfs@wollina.de> Signed-off-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-on: http://review.gluster.com/3615 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* cluster/afr: fix for read-subvolume option does not workJeff Darcy2012-07-031-2/+2
| | | | | | | | | | | | | | changed order of prevered read child in afr_select_read_child_from_policy when a read child is set over config option read-subvolume it shoudl be first to return Change-Id: I1c5a8171379bb2bad76f6653e9d68a9349d55142 BUG: 833750 Original-author: domwo <glusterfs@wollina.de> Signed-off-by: domwo <glusterfs@wollina.de> Signed-off-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-on: http://review.gluster.com/3614 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* mgmt/glusterd: Added spaces in the logsVenkatesh Somyajulu2012-07-021-5/+9
| | | | | | | | | | Change-Id: Ic44e339219a845946e18c8c926fe993e09f86624 BUG: 820555 Signed-off-by: Venkatesh Somyajulu <vsomyaju@redhat.com> Reviewed-on: http://review.gluster.com/3609 Reviewed-by: Kaushal M <kaushal@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* pidinfo: don't let a corrupt /proc/PID/status cause buf[-1] accessJim Meyering2012-07-021-2/+4
| | | | | | | | | Change-Id: I5d10eb92af753513eb5e5e3d7d2ad3ace57917d7 BUG: 789278 Signed-off-by: Jim Meyering <meyering@redhat.com> Reviewed-on: http://review.gluster.com/3597 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* geo-rep: handle input without trailing newline; don't reference buf[-1]Jim Meyering2012-07-021-4/+9
| | | | | | | | | | | | | Do not truncate final byte of a line that does not end in a newline. Do not clobber stack (resbuf[-1]) for input that starts with a NUL byte. Likewise in glusterd_urltransform. Change-Id: Ifdcad02d908c8dcbc1a0eee78d318dd4e7860322 BUG: 789278 Signed-off-by: Jim Meyering <meyering@redhat.com> Reviewed-on: http://review.gluster.com/3595 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* xlators/nfs: don't test/set dirpath[-1] for a zero-length nameJim Meyering2012-07-021-2/+2
| | | | | | | | | Change-Id: Ic6ccfc964c9739f067ccf14a95fd0e09baf0dd51 BUG: 789278 Signed-off-by: Jim Meyering <meyering@redhat.com> Reviewed-on: http://review.gluster.com/3593 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* glusterd-rpc-ops: avoid buffer overrun for over-long keyJim Meyering2012-07-021-1/+3
| | | | | | | | | | | | | | strncpy explicitly does not NUL-terminate when source string has length >= the length specified via strncpy's 3rd argument. Assuming strncpy is justified (i.e., that it may truncate), be sure to NUL-terminate its destination buffer. Change-Id: Ia67bf136cdfae6d9850f673923c01baa3cdef9d8 BUG: 789278 Signed-off-by: Jim Meyering <meyering@redhat.com> Reviewed-on: http://review.gluster.com/3592 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* features/worm: Allow worm option to be set throught volume setshishir gowda2012-07-021-2/+20
| | | | | | | | | | | | | | | | | | | | | | 'volume set <volname> worm on' adds the worm xlator on the bricks. Read-only and worm cannot exist together, and a check is added. Regular volumes can still be mounted with worm mount option. If a volume is started before conversion to worm, the bricks need to be restarted for the option to take force. Updated feature.read-only option to features.read-only to keep it consistent with other features based options. Change-Id: I1a8fab363aaf66e6da615dcffa328332ae39fa04 BUG: 811612 Signed-off-by: shishir gowda <shishirng@gluster.com> Reviewed-on: http://review.gluster.com/3545 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com> Reviewed-by: Anand Avati <avati@redhat.com>
* glusterd: avoid buffer overrun due to lack of NUL terminatorJim Meyering2012-07-021-0/+1
| | | | | | | | | | | | | | Assume that this use of strncpy is not spurious (i.e., that it does sometimes truncate), and ensure that the result is NUL-terminated. Otherwise, callers that treat ->filepath as a NUL-terminated string could operate on a bogus file name and/or segfault. Change-Id: I276bf8a4da330284cc0300e8da7113a48b9b9b37 BUG: 789278 Signed-off-by: Jim Meyering <meyering@redhat.com> Reviewed-on: http://review.gluster.com/3590 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* bdb: fix erroneous strncpy in file name constructionJim Meyering2012-07-021-2/+2
| | | | | | | | | | | | | | | | Using strncpy like that fails to copy the trailing NUL byte of dirent->d_name, which is required, since the result buffer, entry_path is stat'ed in the code just below. Besides, there is no need for strncpy, since we know the source buffer will fit in the possibly-just-realloc'd destination buffer: use memcpy and +1 to include the trailing NUL. Change-Id: I4d4cfb5b7df3c018516919f2d67c21c07de126cb BUG: 789278 Signed-off-by: Jim Meyering <meyering@redhat.com> Reviewed-on: http://review.gluster.com/3588 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* posix: avoid unnecessary strncpyJim Meyering2012-07-021-1/+1
| | | | | | | | | | | | When strlen(SRC) < LEN, using strncpy is misleading. Use strcpy instead. Change-Id: I76832353dc415de99f0583d085d5c2444d5fe8b0 BUG: 789278 Signed-off-by: Jim Meyering <meyering@redhat.com> Reviewed-on: http://review.gluster.com/3587 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* glusterd: Fix peer probe when username/password is missingKaushal M2012-07-021-12/+8
| | | | | | | | | | | | | Prevent failure of building volumes dictionary during peer probe, when username/password for a volume is missing. This situation can be caused by migration of gluster from pre-3.3 to 3.3 and above. Change-Id: Ib924ecd3d941ddaa5c7773e4d45b076c488b6421 BUG: 834229 Signed-off-by: Kaushal M <kaushal@redhat.com> Reviewed-on: http://review.gluster.com/3619 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* glusterd, cli: handle uuid conflicts in probe gracefullyRaghavendra Bhat2012-07-021-0/+15
| | | | | | | | | | | | | | | | | | | | | | | A commonly faced problem among glusterfs users is: after a fresh installation of glusterfs in a virtual machine, the VM image is cloned to make multiple instances of the server. This breaks glusterd because right after glusterfs installation on the first boot glusterd would have created the node UUID and this gets inherited into the clone. The result is wierd behavior at the time of peer probe where glusterd does not (yet) deal with UUID collisions in a user friendly way. With this patch the peer which got the probe request will compare the uuid of the machine which send the probe request with its own uuid and send the proper error to cli if the uuids are same. Change-Id: I091741ec863431fb6480a09a3f4c68a0906a3339 BUG: 811493 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-on: http://review.gluster.com/3612 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com> Reviewed-by: Anand Avati <avati@redhat.com>
* cluster/dht: Remove dht dependency on glusterfsd-mgmtshishir gowda2012-06-291-1/+7
| | | | | | | | | | | | | | | glusterfs_ctx->notify can be used by any xlator to talk to glusterfsd-mgmt. Note- This is for any rpc communication initiated by the xlator, and not from glusterd. Change-Id: Ic0e4af106fe1e98d797ca621facda8839b87598a BUG: 835757 Signed-off-by: shishir gowda <sgowda@redhat.com> Reviewed-on: http://review.gluster.com/3618 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com> Reviewed-by: Anand Avati <avati@redhat.com>
* localtime and ctime are not MT-SAFEKaleb S. KEITHLEY2012-06-2911-115/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are a number of nit-level issues throughout the source with the use of localtime and ctime. While they apparently aren't causing too many problems, apart from the one in bz 828058, they ought to be fixed. Among the "real" problems that are fixed in this patch: 1) general localtime and ctime not MT-SAFE. There's a non-zero chance that another thread calling localtime (or ctime) will over-write the static data about to be used in another thread 2) localtime(& <64-bit-type>) or ctime(& <64-bit-type>) generally not a problem on 64-bit or little-endian 32-bit. But even though we probably have zero users on big-ending 32-bit platforms, it's still incorrect. 3) multiple nested calls passed as params. Last one wins, i.e. over- writes result of prior calls. 4) Inconsistent error handling. Most of these calls are for logging, tracing, or dumping. I submit that if an error somehow occurs in the call to localtime or ctime, the log/trace/dump still should still occur. 5) Appliances should all have their clocks set to UTC, and all log entries, traces, and dumps should use GMT. 6) fix strtok(), change to strtok_r() Other things this patch fixes/changes (that aren't bugs per se): 1) Change "%Y-%m-%d %H:%M:%S" and similar to their equivalent shorthand, e.g. "%F %T" 2) change sizeof(timestr) to sizeof timestr. sizeof is an operator, not a function. You don't use i +(32), why use sizeof(<var>). (And yes, you do use parens with sizeof(<type>).) 3) change 'char timestr[256]' to 'char timestr[32]' where appropriate. Per-thread stack is limited. Time strings are never longer than ~20 characters, so why waste 220+ bytes on the stack? Things this patch doesn't fix: 1) hodgepodge of %Y-%m-%d %H:%M:%S versus %Y/%m/%d-%H%M%S and other variations. It's not clear to me whether this ever matters, not to mention 3rd party log filtering tools may already rely on a particular format. Still it would be nice to have a single manifest constant and have every call to localtime/strftime consistently use the same format. Change-Id: I827cad7bf53e57b69c0173f67abe72884249c1a9 BUG: 832173 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.com/3568 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* protocol/client: Re-open should not have O_CREAT|O_TRUNC|O_EXCLPranith Kumar K2012-06-194-11/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | RCA The bug is observed in 3.2.x because posix xlator changes the uid/gid of file as per frame->root-uid/gid if O_CREAT flag is set in open fop. Posix does not do this in 3.3.x so that bug does not appear anymore but this issue exposed the actual bug in client xlator re-open. Re-open of a file on re-connection should not perform re-open with the same flags at the time of open/create/opendir. Imagine a case where a file is opened with O_TRUNC|O_RDWR and some data is written to it, now if the brick goes down and comes back the file will be truncated. When I tested this case, the file is not truncated because locks xlator resets O_TRUNC unconditionally. Client xlator re-open bug and locks xlator bug cancel each other. Fix Reset O_CREAT|O_TRUNC|O_EXCL flags in re-open. Locks xlator should not reset O_TRUNC. Additional changes Removed wbflags as it is not assigned at all. Testcases Automated go program is at: ://bugzilla.redhat.com/show_bug.cgi?id=807976#c2 Change-Id: I0080344fdda2e62e7c976c35a5bf5f1fa8838891 BUG: 807976 Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Reviewed-on: http://review.gluster.com/3582 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-by: Anand Avati <avati@redhat.com>
* features/marker: use buf->ia_gfid in all the lookup callbacksRaghavendra Bhat2012-06-192-10/+23
| | | | | | | | | | | | | | | | | * In general use buf->ia_gfid for gfid instead of inode's gfid in the callbacks of the fops where new inode is created (such as create, mkdir, mknod, symlink). In the callback path inode would not be having the gfid within it, if it is not yet linked to the inode table which happens in protocol/server. Change-Id: I75b348ad152a1bcd634a4c2db34aca97956ccb21 BUG: 822067 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-on: http://review.gluster.com/3567 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-by: Pranith Kumar Karampuri <pranithk@gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* cluster/afr: Don't reset split-brain when data-self-heal is offPranith Kumar K2012-06-193-2/+4
| | | | | | | | | BUG: 804606 Change-Id: I8cefcb6efa687fac4ad412403c085b3767218f72 Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Reviewed-on: http://review.gluster.com/3586 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* debug/io-stats: if some dict operation fails then goto out instead of proceedingRaghavendra Bhat2012-06-171-2/+8
| | | | | | | | | | | Change-Id: I9c6d9b48c6162f6be2b405bacfc97605909c4e5e BUG: 769826 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-on: http://review.gluster.com/3569 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-by: Pranith Kumar Karampuri <pranithk@gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* cluster/afr: Treat EEXIST as success in hardlinkPranith Kumar K2012-06-141-0/+12
| | | | | | | | | BUG: 831151 Change-Id: I6ecc099cf5f3ae58b19dfb00ed0b3f9959e711e5 Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Reviewed-on: http://review.gluster.com/3571 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
* debug/io-stats: do not store the string allocated from stack into dictRaghavendra Bhat2012-06-131-49/+55
| | | | | | | | | | | | | | * Unlock if some error happens after the lock is held * White space cleanup Change-Id: If90d9a9ae91c485bb21b1ad222af445981edb77b BUG: 769826 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-on: http://review.gluster.com/3565 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-by: Anand Avati <avati@redhat.com>
* gsyncd / geo-rep : failover/failbackCsaba Henk2012-06-133-66/+341
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit is based on Venky Shankar <vshankar@>'s original implementation. Let us first quote Venky's description, then we summarize changes to his work. ------ First version of failover/failback. Failback mechanism uses two exclusive modes: * blind-sync This mode works with xtime pairs (both master and slave) to identify candidated to sync the original master from the slave * wrapup-sync This mode is similar to the normal working of gsyncd except that orphaned entities in the gluster volume are not assigned xtimes. This prevents un-necessary transfer of data for such entities. Modes can be enabled via: gluster volume geo-replication M S config special_sync_mode blind gluster volume geo-replication M S config special_sync_mode wrapup To turn off the special modes (i.e. to revert to normal gsyncd behaviour) use: gluster volume geo-replication colon-d0 192.168.1.2::colon-d config \!special_sync_mode ------ Code has been refactored to meet following goals: - make checkpointing work with special sync modes - move out sync mode related conditionals from the crawl loop and make all decisions to be made at startup time - be intrusive to the crawl loop to smallest possible degree (we will have to change/revisit it for other reasons, and the complexity of that should not increase) So, xtime parsing/updating/evaluation that's specific to the certain special modes are represented as mixin classes; basic operation logic is in an abstract base class. On startup, special-sync-mode tunable is dynamically dispatched to the corresponding mixin and the actual master class is derived from the chosen mixin and the ABS. Change-Id: Ic9b8448f31ad4239a8200dc689f7d713662a67de BUG: 830497 Signed-off-by: Csaba Henk <csaba@redhat.com> Reviewed-on: http://review.gluster.com/3541 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Venky Shankar <vshankar@redhat.com>
* geo-rep: checkpointingCsaba Henk2012-06-135-30/+374
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - gluster vol geo-rep M S conf checkpoint <LABEL|now> sets a checkpoint with LABEL (the keyword "now" is special, it's rendered to the label "as of <timestamp of current time>") that's used to refer to the checkpoint in the sequel. (Technically, gsyncd makes a note of the xtime of master's root as of setting the checkpoint, called the "checkpoint target".) - gluster vol geo-rep M S conf \!checkpoint deletes the checkpoint. - gluster vol geo-rep M S stat if status is OK, and there is a checkpoint configured, the checkpoint info is appended to status (either "not yet reached", or "completed at <timestamp of completion>"). (Technically, the worker runs a thread that monitors / serializes / verifies checkpoint status, and answers checkpoint status requests through a UNIX socket; monitoring boils down to querying the xtime of slave's root and comparing with the target.) - gluster vol geo-rep M S conf log-file | xargs grep checkpoint displays the checkpoint history. Set, delete and completion events are logged properly. Change-Id: I4398e0819f1504e6e496b4209e91a0e156e1a0f8 BUG: 826512 Signed-off-by: Csaba Henk <csaba@redhat.com> Reviewed-on: http://review.gluster.com/3491 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Venky Shankar <vshankar@redhat.com>
* mgmt/glusterd: fix the infinite loop in lazy uuid generationRaghavendra Bhat2012-06-132-1/+3
| | | | | | | | | | | | | | | | | * This is how the lazy uuid generation leads to infinite loop of function calls. MY_UUID -> glusterd_uuid_init -> glusterd_retrieve_uuid -> MY_UUID * Also while starting glusterd if valgrind option is not given in the volfile, then reset the ret variable to 0. Change-Id: Ief719f436d8a264a591ee6aefc6da3c0f6c75e8f BUG: 811493 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-on: http://review.gluster.com/3564 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Pranith Kumar Karampuri <pranithk@gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
* cluster/stripe: implement the coalesce stripe file formatBrian Foster2012-06-075-79/+409
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The coalesce file format for cluster/stripe condenses the striped files to a contiguous layout. The elimination of holes in striped files eliminates space wasted via local filesystem preallocation heuristics and significantly improves read performance. Coalesce mode is implemented with a new 'coalesce' xlator option, which is user-configurable and disabled by default. The format of newly created files is marked with a new 'stripe-coalesce' xattr. Cluster/stripe handles/preserves the format of files regardless of the current mode of operation (i.e., a volume can simultaneously consist of coalesced and non-coalesced files). Files without the stripe-coalesce attribute are assumed to have the traditional format to provide backward compatibility. extras/stripe-merge: support traditional and coalesce stripe formats Update the stripe-merge recovery tool to handle the traditional and coalesced file formats. The format of the file is detected automatically (and verified) via the stripe-coalesce attributes. BUG: 801887 Change-Id: I682f0b4e819f496ddb68c9a01c4de4688280fdf8 Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-on: http://review.gluster.com/3282 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com> Reviewed-by: Anand Avati <avati@redhat.com>
* glusterd: generate node UUID lazilyAnand Avati2012-06-0713-62/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | A commonly faced problem among glusterfs users is: after a fresh installation of glusterfs in a virtual machine, the VM image is cloned to make multiple instances of the server. This breaks glusterd because right after glusterfs installation on the first boot glusterd would have created the node UUID and this gets inherited into the clone. The result is wierd behavior at the time of peer probe where glusterd does not (yet) deal with UUID collisions in a user friendly way. This patch is for the 'prevention' of the issue. The approach here is to avoid generating a UUID on the first start of glusterd, but instead generate a node UUID only when a node UUID is found to be necessary. This naturally avoids the creation of node UUID on first boot and prevents the issue to a large extent. This issue also needs a 'cure' patch, which gives more meaningful error messages to the user and provides CLI to recover from the situations (gluster peer reset?) Change-Id: Ieaaeeaf76ed35385844e98a8e23fc3dd8df5a208 BUG: 811493 Signed-off-by: Anand Avati <avati@redhat.com> Reviewed-on: http://review.gluster.com/3533 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
* io-cache,quick-read: bring down log levelAnand Avati2012-06-072-4/+5
| | | | | | | | | | | | | | | | | | log messages were unnecessarily in INFO level. The two functions with the same name were non-static and actually the quick-read's call landed in the io-cache's version: 2012-06-07 17:02:29.848667] I [io-cache.c:1549:check_cache_size_ok] 0-single-master-io-cache: Max cache size is 33791991808 [2012-06-07 17:02:29.848751] I [io-cache.c:1549:check_cache_size_ok] 0-single-master-quick-read: Max cache size is 33791991808 Changed them to static declaration. Change-Id: Id9daf9593b2832e4c261f95eac6181efea8899a5 BUG: 765227 Signed-off-by: Anand Avati <avati@redhat.com> Reviewed-on: http://review.gluster.com/3536 Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>