summaryrefslogtreecommitdiffstats
path: root/xlators/storage
Commit message (Collapse)AuthorAgeFilesLines
* cluster/stripe: implement the coalesce stripe file formatBrian Foster2012-06-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Use linkat(2) when linking on symlinkEmmanuel Dreyfus2012-06-051-0/+18
| | | | | | | | | | | | | | link(2) behavior is not standardized when it comes to symlink. BSD links to the symlink target (and fails if it does not exist), Linux links to the symlink itself. Use linkat(2) instead of link(2) in order to get a portable behavior. BUG: 764655 Change-Id: If7f6f17b48a4ccf8827c3795ec147306df6b5542 Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org> Reviewed-on: http://review.gluster.com/3507 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* posix: fix the 'ENOENT' logs for setxattr()Amar Tumballi2012-06-041-6/+7
| | | | | | | | | | | | | | from marker, setxattr() is attempted on the path even after the unlink() happens if the fd is still active. In such cases, we should not be logging the failures. Change-Id: Icdd9c951f0d331cdda0bec42ae343302b2dbafde BUG: 766611 Signed-off-by: Amar Tumballi <amarts@redhat.com> Reviewed-on: http://review.gluster.com/3514 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-by: Anand Avati <avati@redhat.com>
* storage/posix: Prevent gfid handle leaksPranith Kumar K2012-05-311-4/+6
| | | | | | | | | | | | | | | | | | | | The case which can lead to gfid handle leaks: Self-heal removes directory '/d' with 10 files in it, in brick b1. This dir is renamed to <landfill>/<hashval of '<brick-path>/d'> by posix. Before the janitor thread could remove the directory, self-heal could remove another directory with same path '/d'. Then again the rename to same path is done by posix as before. The gfid-handles of the old '/d', 10 files in it are not unlinked. To prevent such problems, rename the directory to be removed to <landfill>/<gfid-str>. Change-Id: Iad13708e1ebcc5222b64c058aa9a2d372e1bfa5b BUG: 811970 Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Reviewed-on: http://review.gluster.com/3159 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* storage/posix: Move landfill inside .glusterfsPranith Kumar K2012-05-314-19/+114
| | | | | | | | | Change-Id: Ia2944f891dd62e72f3c79678c3a1fed389854a90 BUG: 811970 Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Reviewed-on: http://review.gluster.com/3158 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* storage/posix: readdirp enhancementsAnand Avati2012-05-281-45/+61
| | | | | | | | | | | | - avoid multiple calls to posix_istat(). use cheaper posix_pstat() - code re-org Change-Id: I4a2e32626ade49b7d18158952849c6fe7bd6875c BUG: 816140 Reviewed-on: http://review.gluster.com/3460 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com> Reviewed-by: Anand Avati <avati@redhat.com>
* storage/posix,fuse-bridge: fill the d_type attribute in READDIRP repliesNiels de Vos2012-05-181-0/+1
| | | | | | | | | | | | | | | | | | | | | | | d_type should contain the type of the the dir-entry (man 3 readdir). Currently the d_type is always set to DT_UNKNOWN (0). The POSIX standard readdir() returns a 'struct dirent' on both Linux and NetBSD with the d_type attribute. Commit bb315cb180c3547218b5ed581d38e76aec74cf94 removed setting d_type in xlators/mount/fuse/src/fuse-bridge.c. This was using d_type_from_stat(). The stat() seems to have been removed for performance reasons. Instead of removing d_type completely, dirent->d_type could have been used. Therefore the fuse-brige can now add "fde->type = entry->d_type" back into fuse_readdir_cbk() without causing the previous performance impact. Change-Id: I4514bbc0acceb33d09c3cf50bda51e34d953efca BUG: 817785 Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.com/3256 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-by: Anand Avati <avati@redhat.com>
* iobuf: option to provide larger size of buffersAmar Tumballi2012-05-031-4/+1
| | | | | | | | | | | | | provide an option to failover to standard allocation if iobuf of required size doesn't exists. this can be achieved by keeping an arena dedicated for all the out of boundary allocations. Change-Id: I41a2bd7d353dc7bcb2e1a6e4b41735afe9865975 Signed-off-by: Amar Tumballi <amarts@redhat.com> BUG: 812784 Reviewed-on: http://review.gluster.com/3136 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* log cleanup: in setxattr() pathAmar Tumballi2012-05-022-4/+24
| | | | | | | | | | | | | | | | | * in posix we log occassionally if errno is ENOTSUP, added a suggestion to mount with 'user_xattr' option. * changed server's *etxattr_cbk to log ENOTSUP in debug level. * changed client's *etxattr_cbk to log ENOTSUP in debug level. Change-Id: Icd604050aaa68546011f2c950ecd7883ac6ee820 Signed-off-by: Amar Tumballi <amarts@redhat.com> BUG: 811957 Reviewed-on: http://review.gluster.com/3140 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
* get rid of ZR_PATH_MAXEmmanuel Dreyfus2012-05-011-3/+3
| | | | | | | | | | | | As suggested by Amar Tumballi Change-Id: Id1cd74fd7530e8c846f3be4a88b1fa301a728cf1 BUG: 764655 Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org> Reviewed-on: http://review.gluster.com/3243 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
* storage/posix: fix illegal memory access in fgetxattr()Amar Tumballi2012-04-271-3/+7
| | | | | | | | | | | | | | we were not checking for the return value of the fgetxattr(key), and used to continue with the allocation even if size was -1, leading to wrong memory access. Change-Id: Ib5cf2e74fee95bc919b12efe89fed5cd25807efd Signed-off-by: Amar Tumballi <amarts@redhat.com> BUG: 815346 Reviewed-on: http://review.gluster.com/3236 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-by: Anand Avati <avati@redhat.com>
* storage/posix: Fix leak of dict in getxattr calls.shishir gowda2012-04-271-3/+1
| | | | | | | | | | | | | | | | | get_new_dict does not take a ref. Ref was taken only when any data was added to the dict. But in the out tag: we call explicit unref, which would move the ref count to -1, if it was a unsuccessful call. unref destroys the dict only if ref == 0. Change-Id: Ie08c301237c2042daf90a7ef25569e3b06e3e1e9 BUG: 816870 Signed-off-by: shishir gowda <shishirng@gluster.com> Reviewed-on: http://review.gluster.com/3240 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
* NetBSD build fixesEmmanuel Dreyfus2012-04-231-0/+2
| | | | | | | | | | | Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org> Change-Id: I8f9aabeadd2f842521a82e59594115bd80155d68 BUG: 2923 Signed-off-by: Emmanuel Dreyfus <manu@netbsd.org> Reviewed-on: http://review.gluster.com/3053 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* core: coverity issues fixedAmar Tumballi2012-04-231-25/+22
| | | | | | | | | | | | this is not a complete set of issues getting fixed. Will address other issues in another patch. Change-Id: Ib01c7b11b205078cc4d0b3f11610751e32d14b69 Signed-off-by: Amar Tumballi <amarts@redhat.com> BUG: 789278 Reviewed-on: http://review.gluster.com/3145 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
* storage/posix: prefer absolute path handles over GFID handlesv3.3.0qa37Anand Avati2012-04-211-12/+12
| | | | | | | | | | Change-Id: I9afefa2f8a39c5f2c77271ea64aff95249c88821 BUG: 791187 Signed-off-by: Anand Avati <avati@redhat.com> Reviewed-on: http://review.gluster.com/3204 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
* storage/posix: Don't allow mkdir() on HIDDEN_DIRECTORYKaushal M2012-04-201-0/+12
| | | | | | | | | | Change-Id: Iecbd71d13ee8a492a99689674be99b4a451593db BUG: 788150 Signed-off-by: Kaushal M <kaushal@redhat.com> Reviewed-on: http://review.gluster.com/3200 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
* storage/posix: Handle gfid-less lookupPranith Kumar K2012-04-121-3/+9
| | | | | | | | | Change-Id: I4605dbb1dd8bf8e26de7f253e54a7f4840c8a8be BUG: 795355 Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Reviewed-on: http://review.gluster.com/3128 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* Fix compiler warnings and typos from Debian build.Jeff Darcy2012-04-101-1/+1
| | | | | | | | | | | | | Mostly to do with "-Werror=format-security" being buggy, but while we're here we might as well fix some typos and such. Credit goes to Patrick Matthäi <pmatthaei@debian.org> for pointing these out. Change-Id: Ia32d1111d7c10b1f213df85d86b17a1326248ffd BUG: 811387 Signed-off-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-on: http://review.gluster.com/3117 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* storage/posix: Avoid excessive logging in posix.v3.3.0qa34Mohammed Junaid2012-04-093-5/+32
| | | | | | | | | | | | | | When quota or gsyncd is enabled, the marker translator performs setxattr on files/directories. If the file/directory is deleted before setxattr, posix gets an error when it does setxattr and logs it. But its not an error for marker and it handles the case gracefully. Hence, avoid logging for these keys. Change-Id: Ic614777399497be92ed1c2b4718d46adfb639d96 BUG: 765498 Signed-off-by: Mohammed Junaid <junaid@redhat.com> Reviewed-on: http://review.gluster.com/3105 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
* Replace GPLV3 MD5 with OpenSSL MD5Kaleb KEITHLEY2012-04-043-7/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Ric asked me to look at replacing the GPL licensed MD5 code with something better, i.e. perhaps faster, and with a less restrictive license, etc. So I took a couple hour holiday from working on wrapping up the client_t and did this. OpenSSL (nee SSLeay) is released under the OpenSSL license, a BSD/MIT style license. OpenSSL (libcrypto.so) is used on Linux, OS X and *BSD, Open Solaris, etc. IOW it's universally available on the platforms we care about. It's written by Eric Young (eay), now at EMC/RSA, and I can say from experience that the OpenSSL implementation of MD5 (at least) is every bit as fast as RSA's proprietary implementation (primarily because the implementations are very, very similar.) The last time I surveyed MD5 implementations I found they're all pretty much the same speed. I changed the APIs (and ABIs) for the strong and weak checksums. Strictly speaking I didn't need to do that. They're only called on short strings of data, i.e. pathnames, so using int32_t and uint32_t is ostensibly okay. My change is arguably a better, more general API for this sort of thing. It's also what bit me when gerrit/jenkins validation failed due to glusterfs segv-ing. (I didn't pay close enough attention to the implementation of the weak checksum. But it forced me to learn what gerrit/jenkins are doing and going forward I can do better testing before submitting to gerrit.) Now resubmitting with a BZ Change-Id: I545fade1604e74fc68399894550229bd57a5e0df BUG: 807718 Signed-off-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.com/3019 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
* core: adding extra data for fopsAmar Tumballi2012-03-221-104/+109
| | | | | | | | | | | | | with this change, the xlator APIs will have a dictionary as extra argument, which is passed between all the layers. This can be utilized for overloading in some of the operations. Change-Id: I58a8186b3ef647650280e63f3e5e9b9de7827b40 Signed-off-by: Amar Tumballi <amarts@redhat.com> BUG: 782265 Reviewed-on: http://review.gluster.com/2960 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* storage/posix: don't allow rmdir()/lookup() on HIDDEN_DIRECTORYAmar Tumballi2012-03-141-1/+26
| | | | | | | | | | | so that we won't even have a GFID set on the GFID dir itself. Change-Id: I65be7d675a308f51f4c62a86499341412b20c47f Signed-off-by: Amar Tumballi <amarts@redhat.com> BUG: 802726 Reviewed-on: http://review.gluster.com/2936 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
* posix_fill_readdir: Using strcmp to compare GF_HIDDEN_PATH with ↵M S Vishwanath Bhat2012-03-111-2/+1
| | | | | | | | | | | entry->d_name instead of strncmp. Change-Id: I29b6fc81213e52a697ed96559c3216c5512799ed BUG: 802005 Signed-off-by: M S Vishwanath Bhat <vishwanath@gluster.com> Reviewed-on: http://review.gluster.com/2910 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com>
* glusterd/rebalance: Bring in support for parallel rebalanceshishirng2012-03-071-1/+1
| | | | | | | | | | | | | | | | | This patch, enables rebalance processes to be started on all nodes where the volume is spread across (1 process per node) node-uuid xattr identifies which node takes ownership of the task to migrate the file. The model employed is push (src pushes to dst) Change-Id: Ieacd46a6216cf6ded841bbaebd10cfaea51c16d6 BUG: 763844 Signed-off-by: shishirng <shishirng@gluster.com> Reviewed-on: http://review.gluster.com/2873 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
* storage/posix: In lookup check for buf->gfid being NULLshishir gowda2012-02-291-0/+6
| | | | | | | | | | | | | | There are few cases where create and lookup race. Lookup ends up getting a valid struct iatt, but with no gfid set. We need to check for gfid being 0, and handle it as an error. Signed-off-by: shishir gowda <shishirng@gluster.com> Change-Id: I36ae1978b325aff964cbc3b24730c1e993666267 BUG: 797167 Reviewed-on: http://review.gluster.com/2832 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
* glusterfsd: unref the dict and free the memory to avoid memleakRaghavendra Bhat2012-02-271-0/+1
| | | | | | | | | | Change-Id: Ib7a1f8cbab039fefb73dc35560a035d5688b0e32 BUG: 796186 Signed-off-by: Raghavendra Bhat <raghavendrabhat@gluster.com> Reviewed-on: http://review.gluster.com/2808 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
* Introduce new extended attribute: node-uuidVenky Shankar2012-02-222-34/+90
| | | | | | | | | | | | | | | | Request for trusted.glusterfs.node-uuid returns pathinfo like string but containing the UUID of glusterd instead of the backend path for the requested file. This info is benificial for tasks like parallel rebalance that will make use of the UUID for data locality. Change-Id: I766a09cc4a5f63aebd11c73107924a1b29242dcf BUG: 772610 Signed-off-by: Venky Shankar <vshankar@redhat.com> Reviewed-on: http://review.gluster.com/2614 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Shishir Gowda <shishirng@gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
* storage/posix: Add xattr for gfid2pathPranith Kumar K2012-02-201-0/+19
| | | | | | | | | Change-Id: I1fe987d255bf50e8433043749b482b67554a0ac3 BUG: 763820 Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Reviewed-on: http://review.gluster.com/2774 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
* glusterd: auth allow enhancementsRajesh Amaravathi2012-02-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * PROBLEM: When address-based authentication is enabled on a volume, the gNfs server, self-heal daemon (shd), and other operations such as quota, rebalance, replace-brick and geo-replication either stop working or the services are not started if all the peers' ipv{4,6} addresses or hostnames are not added in the "set auth.allow" operation, breaking the functionality of several operations. E.g: volume vol in a cluster of two peers: /mnt/brick1 in 192.168.1.4 /mnt/brick2 in 192.168.1.5 option auth.allow 192.168.1.6 (allow connection requests only from 192.168.1.6) This will disrupt the nfs servers on 192.168.1.{4,5}. brick server processes reject connection requests from both nfs servers (on 4,5), because the peer addresses are not in the auth.allow list. Same holds true for local mounts (on peer machines), self-heal daemon, and other operations which perform a glusterfs mount on one of the peers. * SOLUTION: Login-based authentication (username/password pairs, henceforth referred to as "keys") for gluster services and operations. These *per-volume* keys can be used to by-pass the addr-based authentication, provided none of the peers' addresses are put in the auth.reject list, to enable gluster services like gNfs, self-heal daemon and internal operations on volumes when auth.allow option is exercised. * IMPLEMENTATION: 1. Glusterd generates keys for each volume and stores it in memory as well as in respective volfiles. A new TRUSTED-FUSE volfile is generated which is fuse volfile + keys in protocol/client, and is named trusted-<volname>-fuse.vol. This is used by all local mounts. ANY local mount (on any peer) is granted the trusted-fuse volfile instead of fuse volfile via getspec. non-local mounts are NOT granted the trusted fuse volfile. 2. The keys generated for the volume is written to each server volfile telling servers to allow users with these keys. 3. NFS, self-heal daemon and replace-brick volfiles are updated with the volume's authentication keys. 4. The keys are NOT written to fuse volfiles for obvious reasons. 5. The ownership of volfiles and logfiles is restricted to root users. 6. Merging two identical definitions of peer_info_t in auth/addr and rpc-lib, throwing away the one in auth/addr. 7. Code cleanup in numerous places as appropriate. * IMPORTANT NOTES: 1. One SHOULD NOT put any of the peer addresses in the auth.reject list if one wants any of the glusterd services and features such as gNfs, self-heal, rebalance, geo-rep and quota. 2. If one wants to use username/password based authentication to volumes, one shall append to the server, nfs and shd volfiles, the keys one wants to use for authentication, *while_retaining those_generated_by_glusterd*. See doc/authentication.txt file for details. Change-Id: Ie0331d625ad000d63090e2d622fe1728fbfcc453 BUG: 789942 Signed-off-by: Rajesh Amaravathi <rajesh@redhat.com> Reviewed-on: http://review.gluster.com/2733 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
* cluster/dht: Support for hardlink rebalance when decommissioningshishir gowda2012-02-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The support for hardlink rebalance is only available for decommissioning of a node. this can be triggered in two ways 1. remove-brick start 2. if decommission node value is set in vol file, then a normal rebalance command The way we handle it is- if (nlink > 1) do * if src file doesnt have linkto xattr * mark src's linkto to the dst * else * perform a link on the dst * do a look up * if nlinks = dst.nlinks * migrate data * else * continue crawling done Signed-off-by: shishir gowda <shishirng@gluster.com> Change-Id: If43b5524b872fd1413e9f7aa7f436cb244e30d8d BUG: 763844 Reviewed-on: http://review.gluster.com/2737 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com>
* posix: handle some internal behavior in posix_mknod()Amar Tumballi2012-02-163-0/+40
| | | | | | | | | | | | | | | | | | | | assume a case of link() systemcall, which is handled in distribute by creating a 'linkfile' in hashed subvolume, if the 'oldloc' is present in different subvolume. we have same 'gfid' for the linkfile as that of file for consistency. Now, a file with multiple hardlinks, we may end up with 'hardlinked' linkfiles. dht create linkfile using 'mknod()' fop, and as now posix_mknod() is not equipped to handle this situation. this patch fixes the situation by looking at the 'internal' key set in the dictionary to differentiate the call which originates from inside with regular system calls. Change-Id: Ibff7c31f8e0c8bdae035c705c93a295f080ff985 BUG: 763844 Signed-off-by: Amar Tumballi <amar@gluster.com> Reviewed-on: http://review.gluster.com/2755 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* storage/posix: reset op_ret to -1 after call to MAKE_INODE_HANDLEshishir gowda2012-02-161-0/+5
| | | | | | | | | | | | MAKE_INODE_HANDLE uses op_ret. We do not reset it to -1, and in few instances we jump to label out, where we unwind with op_ret. Change-Id: Iac4d9f250f5253b3ce0cd91cc385168247efd4a8 BUG: 788998 Signed-off-by: shishir gowda <shishirng@gluster.com> Reviewed-on: http://review.gluster.com/2759 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amarts@redhat.com>
* core: add an extra flag to readv()/writev() APIAmar Tumballi2012-02-141-4/+4
| | | | | | | | | | | | needed to implement a proper handling of open flag alterations using fcntl() on fd. Change-Id: Ic280d5db6f1dc0418d5c439abb8db1d3ac21ced0 Signed-off-by: Amar Tumballi <amar@gluster.com> BUG: 782265 Reviewed-on: http://review.gluster.com/2723 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
* storage/posix: Fix rename gfid handle unsetPranith Kumar K2012-01-291-4/+4
| | | | | | | | | Change-Id: I365ef264056691914ad5bd620d8150f8b71ec887 BUG: 785524 Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Reviewed-on: http://review.gluster.com/2698 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@gluster.com>
* storage/posix: janitor should unset gfid handlesPranith Kumar K2012-01-291-0/+8
| | | | | | | | | Change-Id: I449b6a55122dfc27035569e6eb1d74ddcea68a69 Signed-off-by: Pranith Kumar K <pranithk@gluster.com> BUG: 785522 Reviewed-on: http://review.gluster.com/2697 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@gluster.com>
* core: add 'fremovexattr()' fopAmar Tumballi2012-01-251-0/+54
| | | | | | | | | | | so operations can be done on fd for extended attribute removal Change-Id: Ie026f1b53793aeb4ae33e96ea5408c7a97f34bf6 Signed-off-by: Amar Tumballi <amar@gluster.com> BUG: 766571 Reviewed-on: http://review.gluster.com/778 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@gluster.com>
* core: get xattrs also as part of readdirpAmar Tumballi2012-01-252-25/+57
| | | | | | | | | | | | | readdirp_req() call sends a dict_t * as an argument, which contains all the xattr keys for which the entries got in readdirp_rsp() are having xattr value filled dictionary. Change-Id: I8b7e1290740ea3e884e67d19156ce849227167c0 Signed-off-by: Amar Tumballi <amar@gluster.com> BUG: 765785 Reviewed-on: http://review.gluster.com/771 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@gluster.com>
* storage/posix: Pass correct size to sys_lgetxattrroot2012-01-231-1/+1
| | | | | | | | | | | | | We were passing op_ret (0), instead of size variable obtained by previous sys_lgetxattr to determine the size Signed-off-by: root <shishirng@gluster.com> Change-Id: I886dedc2ab752ac1feabe7a79725ea5f069d6865 BUG: 783916 Reviewed-on: http://review.gluster.com/2676 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Rahul C S <rahulcs@redhat.com> Reviewed-by: Amar Tumballi <amar@gluster.com>
* core: GFID filehandle based backend and anonymous FDsAnand Avati2012-01-206-549/+1313
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. What -------- This change introduces an infrastructure change in the filesystem which lets filesystem operation address objects (inodes) just by its GFID. Thus far GFID has been a unique identifier of a user-visible inode. But in terms of addressability the only mechanism thus far has been the backend filesystem path, which could be derived from the GFID only if it was cached in the inode table along with the entire set of dentry ancestry leading up to the root. This change essentially decouples addressability from the namespace. It is no more necessary to be aware of the parent directory to address a file or directory. 2. Why ------- The biggest use case for such a feature is NFS for generating persistent filehandles. So far the technique for generating filehandles in NFS has been to encode path components so that the appropriate inode_t can be repopulated into the inode table by means of a recursive lookup of each component top-down. Another use case is the ability to perform more intelligent self-healing and rebalancing of inodes with hardlinks and also to detect renames. A derived feature from GFID filehandles is anonymous FDs. An anonymous FD is an internal USABLE "fd_t" which does not map to a user opened file descriptor or to an internal ->open()'d fd. The ability to address a file by the GFID eliminates the need to have a persistent ->open()'d fd for the purpose of avoiding the namespace. This improves NFS read/write performance significantly eliminating open/close calls and also fixes some of today's limitations (like keeping an FD open longer than necessary resulting in disk space leakage) 3. How ------- At each storage/posix translator level, every file is hardlinked inside a hidden .glusterfs directory (under the top level export) with the name as the ascii-encoded standard UUID format string. For reasons of performance and scalability there is a two-tier classification of those hardlinks under directories with the initial parts of the UUID string as the directory names. For directories (which cannot be hardlinked), the approach is to use a symlink which dereferences the parent GFID path along with basename of the directory. The parent GFID dereference will in turn be a dereference of the grandparent with the parent's basename, and so on recursively up to the root export. 4. Development --------------- 4a. To leverage the ability to address an inode by its GFID, the technique is to perform a "nameless lookup". This means, to populate a loc_t structure as: loc_t { pargfid: NULL parent: NULL name: NULL path: NULL gfid: GFID to be looked up [out parameter] inode: inode_new () result [in parameter] } and performing such lookup will return in its callback an inode_t populated with the right contexts and a struct iatt which can be used to perform an inode_link () on the inode (without a parent and basename). The inode will now be hashed and linked in the inode table and findable via inode_find(). A fundamental change moving forward is that the primary fields in a loc_t structure are now going to be (pargfid, name) and (gfid) depending on the kind of FOP. So far path had been the primary field for operations. The remaining fields only serve as hints/helpers. 4b. If read/write is to be performed on an inode_t, the approach so far has been to: fd_create(), STACK_WIND(open, fd), fd_bind (in callback) and then perform STACK_WIND(read, fd) etc. With anonymous fds now you can do fd_anonymous (inode), STACK_WIND (read, fd). This results in great boost in performance in the inbuilt NFS server. 5. Misc ------- The inode_ctx_put[2] has been renamed to inode_ctx_set[2] to be consistent with the rest of the codebase. Change-Id: Ie4629edf6bd32a595f4d7f01e90c0a01f16fb12f BUG: 781318 Reviewed-on: http://review.gluster.com/669 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@gluster.com>
* Avoid setting dict when size is -1Rahul C S2012-01-031-0/+5
| | | | | | | | | | | | | when lgetxattr fails and returns size as -1, we still try to set the dict. Instead it should set proper errno & exit. Change-Id: I282dc0765e562bd9bbcf852453cd3b72d918b269 BUG: 771313 Signed-off-by: Rahul C S <rahulcs@redhat.com> Reviewed-on: http://review.gluster.com/2555 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
* case to uint64_t when convering gfid to inode, otherwise it can getEmmanuel Dreyfus2011-11-241-1/+1
| | | | | | | | | | garbled on 32 bit machines. Change-Id: Id2acc1f9ae98194d541f5468616be441896c4239 BUG: 2923 Reviewed-on: http://review.gluster.com/753 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@gluster.com>
* storage/posix: assign ino as -1 if gfid is missingPranith Kumar K2011-11-161-1/+6
| | | | | | | | Change-Id: I422c87f977b5da083f9fcfaf20f0ca9a872da0a4 BUG: 3767 Reviewed-on: http://review.gluster.com/677 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amar@gluster.com>
* core: made changes to return value of __is_root_gfid()Amar Tumballi2011-10-021-1/+1
| | | | | | | | | | | now returns 'true(1)' is gfid is root, 'false(0)' if not. earlier it was the inverse, which was bit confusing Change-Id: Id103f444ace048cbb0fccdc72c6646da06631584 BUG: 3518 Reviewed-on: http://review.gluster.com/549 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
* statedump: do not print the inode number in the statedumpRaghavendra Bhat2011-10-011-11/+5
| | | | | | | | | | | | | Since gfid is used to uniquely identify a inode, in the statedump printing inode number is not necessary. Its suffecient if the gfid of the inode is printed. And do not print the the inodelks, entrylks and posixlks if the lock count is 0. Change-Id: Idac115fbce3a5684a0f02f8f5f20b194df8fb27f BUG: 3476 Reviewed-on: http://review.gluster.com/530 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Amar Tumballi <amar@gluster.com>
* storage/posix : prevent unmount of underlying fsKaushal M2011-09-272-1/+15
| | | | | | | | | | | | | posix xlator now performs opendir () on the brick directory during init (). This will prevent the underlying filesystem mounted to that directory from being unmounted. Change-Id: I02c190ab8a91abc4ab06959b36f50e0a3fa527ae BUG: 3578 Reviewed-on: http://review.gluster.com/509 Reviewed-by: Amar Tumballi <amar@gluster.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
* posix-getxattr: Honor xattr name if specifiedshishir gowda2011-09-221-4/+55
| | | | | | | | | | | | | | Currently, getxattr works like listxattr, and does not honor a call with a name (key) being specified. The fix handles such scenarios when a name is passed. If the name param is NULL, then it behaves like a listxattr. Changing key size to 4096, as 1024 might not be sufficient length for keys. Change-Id: I317b2e6372e97048e3166d91145c19c9e92e647e BUG: 3599 Reviewed-on: http://review.gluster.com/486 Reviewed-by: Amar Tumballi <amar@gluster.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
* storage/posix: Filter custom getxattrs in lookupPranith Kumar K2011-09-201-2/+33
| | | | | | | | Change-Id: If948ff1b355ea4fd92036bcc43e7b32325aeb3e4 BUG: 3470 Reviewed-on: http://review.gluster.com/325 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
* Proactive self heal process implementationPranith Kumar K2011-09-141-0/+1
| | | | | | | | Change-Id: I96db0d94566ceabf1649f890318363f738c06553 BUG: 2458 Reviewed-on: http://review.gluster.com/403 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
* support for de-commissioning a node using 'remove-brick'Amar Tumballi2011-09-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | to achieve this, we now create volume-file with 'decommissioned-nodes' option in distribute volume, then just perform the rebalance set of operations (with 'force' flag set). now onwards, the 'remove-brick' (with 'start' option) operation tries to migrate data from removed bricks to existing bricks. 'remove-brick' also supports similar options as of replace-brick. * (no options) -> works as 'force', will have the current behavior of remove-brick, ie., no data-migration, volume changes. * start (starts remove-brick with data-migration/draining process, which takes care of migrating data and once complete, will commit the changes to volume file) * pause (stop data migration, but keep the volume file intact with extra options whatever is set) * abort (stop data-migration, and fall back to old configuration) * commit (if volume is stopped, commits the changes to volumefile) * force (stops the data-migration and commits the changes to volume file) Change-Id: I3952bcfbe604a0952e68b6accace7014d5e401d3 BUG: 1952 Reviewed-on: http://review.gluster.com/118 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
* distribute rebalance: handle the open file migrationAmar Tumballi2011-09-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Complexity involved: To migrate a file with open fd, we have to notify the other client process which has the open fd, and make sure the write()s happening on that fd is properly synced to the migrated file. Once the migration is complete, the client process which has open-fd should get notified and it should start performing all the operations on the new subvolume, instead of earlier cached volume. How to solve the notification part: We can overload the 'postbuf' attribute in the _cbk() function to understand if a file is 'under-migration' or 'migration-complete' state. (This will be something similar to deciding whether a file is DHT-linkfile by its 'mode'). Overall change includes below mentioned major changes: 1. dht_linkfile is decided by only 2 factors (mode(01000), xattr(trusted.glusterfs.dht.linkto)), instead of earlier 3 factors (size==0) 2. in linkfile self-heal part (in 'dht_lookup_everywhere_cbk()'), don't delete a linkfile if there is a open-fd on it. It means, there may be a migration in progress. 3. if a file's revalidate fails with ENOENT, it may be due to file migration, and hence need a lookup_everywhere() 4. There will be 2 phases of file-migration. -> Phase 1: Migration in progress * The source data file will have SGID and STICKY bit set in its mode. * The source data file will have a 'linkto' xattr pointing the destination. * Destination file will have mode set to '01000', and 'linkto' xattr set to itself. -> Phase 2: File migration Complete * The source data file will have mode '01000', and will be 'truncated' to size 0. * The destination file will have inherited mode from the source. (without sgid and sticky bit) and its 'linkto' attribute will be removed. 4. Changes in distribute to work smoothly with a file which is in migration / got migrated. The 'fops' are divided into 3 categories, inode-read, inode-write and others. inode-read fops need to handle only 'phase 2' notification, where as, the inode-write fops need to handle both 'phase 1' and phase2. The inode-write operations will be done on source file, and if any of 'file-migration' procedures are detected in _cbk(), then the operations should be performed on the destination too. when a phase-2 is detected, then the inode-ctx itself should be changed to represent a new layout. With these changes, the open file migration will work smoothly with multiple clients. Change-Id: I512408463814e650f34c62ed009bf2101d016fd6 BUG: 3071 Reviewed-on: http://review.gluster.com/209 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>