summaryrefslogtreecommitdiffstats
path: root/api
Commit message (Collapse)AuthorAgeFilesLines
* gfapi: Fix IO error caused when there is consecutive graph switchesPoornima G2016-08-243-6/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Backport of http://review.gluster.org/#/c/14722/ This is part 2 of the fix, the part 1 can be found at: http://review.gluster.org/#/c/14656/ Problem: ======= Consider a race between, __glfs_active_subvol() and graph_setup(). Lets say @TIME T1: fs->active_subvol = A fs->next_subvol = B __glfs_active_subvol() //under lock fs->mutex { .... new_subvol = fs->next_subvol //which is B .... //Start migration from A to B __glfs_first_lookup(){ .... unlock fs->mutex //@TIME T2 network fop lock fs->mutex .... } .... //migration continue on B fs->active_subvol = fs->next_subvol //which is C (explained below) .... } @Time T2, lets say in another thread, graph_setup() is called with C, note that at T2, fs->mutex is unlocked. graph_stup(C...) { lock fs->mutex .... if (fs->next_subvol) // which is B destroy subvol (fs->next_subvol) .... fs->next_subvol = C .... unlock fs->mutex } Thus at the end of this, fs->old_subvol = A; fs->active_subvol = C; fs->next_subvol = NULL; which is wrong, as B completed migration, but was destroyed by graph_setup, and C never was migrated. Solution: ========= Any new graph can be in one of the 2 states: - Picked for migration, migration in progress (fs->mip_subvol) - Not picked so far for migration (fs->next_subvol) graph_setup() updates fs->next_subvol only, __glfs_active_subvol() moves fs->next_subvol to fs->mip_subvol and fs->next_subvol = NULL atomically, and then once the migration is complete, make that the fs->active_subvol > Reviewed-on: http://review.gluster.org/14722 > 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: Raghavendra Talur <rtalur@redhat.com> > Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> > Reviewed-by: Niels de Vos <ndevos@redhat.com> BUG: 1367294 Change-Id: Ib6ff0565105c5eedb912a43da4017cd413243612 Signed-off-by: Poornima G <pgurusid@redhat.com> Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name> Reviewed-on: http://review.gluster.org/15167 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: Kaushal M <kaushal@redhat.com>
* gfapi: Fix IO error caused when there is consecutive graph switchesPoornima G2016-08-241-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Issue: Consider a simple situation, where glfs_init() is done, i.e. initial graph is up. Now perform 2 volume sets that results in 2 client side graph changes. After this perform some IO, the IO fails with ENOTCON. The only way to recover this client is i guess another graph switch or restart. What actually is happening from code perspective: Initial graph lets say A, followed by 2 consecutive graph switches to B and C without any IO those two switches. - graph_setup (A) as a result of GF_EVENT_CHILD_UP, and fs->next_subvol = A - glfs_init() results in fs->active_subvol = A, fs->next_subvol = NULL - graph_setup (B) as a result of GF_EVENT_CHILD_UP, and fs->next_subvol = B - graph_setup (C) as a result of GF_EVENT_CHILD_UP, and fs->next_subvol = C. It also sees that the previous graph B was never set as fs->active_subvol, i.e. no IO or anything happened on B, so can safely send GF_EVENT_PARENT_DOWN (by calling glfs_subvol_done(B)). This parent down on B, results in child_down(B), which is fine. But child_down also triggers graph_setup(B). - graph_setup(B) as a result of GF_EVENT_CHILD_DOWN, and fs->next_subvol = B, and GF_EVENT_PARENT_DOWN on C as explained above. This again leads to GF_EVENT_CHILD_DOWN on C. - graph_setup(C) as a result of GF_EVENT_CHILD_DOWN, and fs->next_subvol = C, and GF_EVENT_PARENT_DOWN on B as explained above. Thus both the graphs B and C are disconnected, and hence the ENOTCON Solution: Remove the call to graph_setup() when the event is GF_EVENT_CHILD_DOWN. It don't see any reason why graph_setup should be called when there is child_down. Not sure what the original reason was, to have graph_setup in child_down. git hostory shows the first patch itself had this call. > Reviewed-on: http://review.gluster.org/14656 > 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: Jeff Darcy <jdarcy@redhat.com> BUG: 1367294 Change-Id: I9de86555f66cc94a05649ac863b40ed3426ffd4b Signed-off-by: Poornima G <pgurusid@redhat.com> Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name> Reviewed-on: http://review.gluster.org/14835 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: Kaushal M <kaushal@redhat.com>
* gfapi: use const qualifier for glfs_*timens()Oleksandr Natalenko2016-08-122-6/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | glfs_*timens() functions have the last argument of struct timespec type that is supposed to be const. Now using glfs_*timens() in fops, implemented on top of FUSE library, leads to compiler-time warning about discarding const qualifier. Introducing const qualifier does not break ABI, so let's just fix it. > Reviewed-on: http://review.gluster.org/15119 > 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: Niels de Vos <ndevos@redhat.com> BUG: 1365869 Change-Id: Iea2a1018de7dce67f67a8229671a5978246de800 Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name> Reviewed-on: http://review.gluster.org/15137 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: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-by: Prashanth Pai <ppai@redhat.com>
* gfapi: add missing glfs_truncateJeff Darcy2016-08-124-3/+51
| | | | | | | | | | | | | | | | | | | > Reviewed-on: http://review.gluster.org/13927 > 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: Kaleb KEITHLEY <kkeithle@redhat.com> BUG: 1366286 Change-Id: I80b016090a4d9d86278a0a5144dd58c0cbfe9bb2 Signed-off-by: Jeff Darcy <jdarcy@redhat.com> Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name> Reviewed-on: http://review.gluster.org/15150 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Prashanth Pai <ppai@redhat.com>
* gfapi : Avoid double freeing of dict in glfs_*_*getxattrJiffin Tony Thottan2016-08-031-5/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The dict variable "xattr" is passed to glfs_getxattr_process() and glfs_listxattr_process() in glfs_*_*getxattrs(). This variable is unrefed by both functions and again in caller function which may result in segfault. So it is wrong to call dict_unref() in both glfs_*xattr_process functions. Backport reference : >Change-Id: I227f55ebc3169f58910863c04ae536a8d789e80e >BUG: 1247603 Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> >Reviewed-on: http://review.gluster.org/13483 >Smoke: Gluster Build System <jenkins@build.gluster.com> >NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> >CentOS-regression: Gluster Build System <jenkins@build.gluster.com> >Reviewed-by: Niels de Vos <ndevos@redhat.com> Change-Id: I2e574ff4b7a095749540bdb9d3593bc1d6275e56 BUG: 1311407 Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name> Reviewed-on: http://review.gluster.org/13505 Reviewed-by: Prashanth Pai <ppai@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Niels de Vos <ndevos@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
* gfapi/upcall: Fix a ref leakSoumya Koduri2016-08-031-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | inode_find (used to create the handle) takes a reference of the inode. This needs to be un'refernced to avoid leak. This is backport of below master patch - http://review.gluster.org/14984 >Change-Id: I22f03577a8f1d9608cfc62d57202cfc4c2ba12b3 >BUG: 1358608 >Signed-off-by: Soumya Koduri <skoduri@redhat.com> >Reviewed-on: http://review.gluster.org/14984 >Reviewed-by: jiffin tony Thottan <jthottan@redhat.com> >Reviewed-by: Jeff Darcy <jdarcy@redhat.com> >(cherry picked from commit bb48eb46910085928efbd7fb491c5b2db25bba98) Change-Id: Iaa91ee757e3497e25d8669c1592106b6266057a0 BUG: 1362010 Signed-off-by: Soumya Koduri <skoduri@redhat.com> Reviewed-on: http://review.gluster.org/15057 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
* glfs/upcall: entries should be removed under mutex lockSoumya Koduri2016-08-022-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During poll, upcall entries should be removed from the upcall_list only under upcall_list_mutex lock. Otherwise it could result in the list corruption if there are entries being added during poll resulting in memory leak. Also addressed a probable leak during any failures with upcall entry addition. This is backport of below master patch - http://review.gluster.org/14972 >Change-Id: I468183f961eb6faed9a0a1bcb783705f711641fc >BUG: 1358608 >Signed-off-by: Soumya Koduri <skoduri@redhat.com> >Reviewed-on: http://review.gluster.org/14972 >Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> >Reviewed-by: Jeff Darcy <jdarcy@redhat.com> >(cherry picked from commit 89dee8b46e126bc1d7541da90fa60844aa83451e) Change-Id: Ib6702911ca1fa09a3f1a493b27195665603854d3 BUG: 1362010 Signed-off-by: Soumya Koduri <skoduri@redhat.com> Reviewed-on: http://review.gluster.org/15058 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Niels de Vos <ndevos@redhat.com>
* gfapi: update count when glfs_buf_copy is usedRaghavendra Talur2016-07-071-2/+3
| | | | | | | | | | | | | | | | | | | | | Backport of http://review.gluster.org/#/c/14854 glfs_buf_copy collates all iovecs into a iovec with count=1. If gio->count is not updated it will lead to dereferencing of invalid address. Change-Id: I7c58071d5c6515ec6fee3ab36af206fa80cf37c3 BUG: 1352482 Signed-off-by: Raghavendra Talur <rtalur@redhat.com> Signed-off-by: Poornima G <pgurusid@redhat.com> Reported-By: Lindsay Mathieson <lindsay.mathieson@gmail.com> Reported-By: Dmitry Melekhov <dm@belkam.com> Reported-By: Tom Emerson <TEmerson@cyberitas.com> Reviewed-on: http://review.gluster.org/14859 Smoke: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Prashanth Pai <ppai@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
* gfapi/handleops: Avoid using glfd during createSoumya Koduri2016-07-031-23/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To avoid leaking glfd while creating a file using handleops and since application shall not be interested in it, use the 'fd' object directly which can be un'refed post create. This is backport of below mainline patch - http://review.gluster.org/14532 > Change-Id: I119874ffb63fb4aa18f846ba1fdbe77874b66a54 > BUG: 1339553 > Signed-off-by: Soumya Koduri <skoduri@redhat.com> > Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> > Reviewed-on: http://review.gluster.org/14532 > NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> > Reviewed-by: Niels de Vos <ndevos@redhat.com> > CentOS-regression: Gluster Build System <jenkins@build.gluster.org> > Tested-by: Gluster Build System <jenkins@build.gluster.org> > Smoke: Gluster Build System <jenkins@build.gluster.org> (cherry picked from commit 763ed1017b0011934ad2414d7396c46e528ea5b3) Change-Id: I119874ffb63fb4aa18f846ba1fdbe77874b66a54 BUG: 1351877 Signed-off-by: Soumya Koduri <skoduri@redhat.com> Reviewed-by: Kaleb S KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.org/14840 NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Niels de Vos <ndevos@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.org>
* gfapi : check the value "iovec" in glfs_io_async_cbk only for readJiffin Tony Thottan2016-06-291-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The glfs_io_async_cbk() is called from the cbk of all the async ops such as write, read, fsync, ftruncate. In all other cases, expect for read the value for "iovec" is NULL. From the code, glfs_io_async_cbk checks the value in common routine which may end up in failures. Thanks Joe Julian for finding issue and suggesting the fix. Cherry picked from commit 61d72b3d91f2655b04de4ef29262f738a8cf7369: > Change-Id: I0be0123da68f9d8fbb5d94ede2d45566a9add6a5 > BUG: 1349276 > Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> > Reported-by: Joe Julian <me@joejulian.name> > Reviewed-on: http://review.gluster.org/14779 > Reviewed-by: Niels de Vos <ndevos@redhat.com> > Smoke: Gluster Build System <jenkins@build.gluster.org> > Tested-by: Kaleb KEITHLEY <kkeithle@redhat.com> > NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> > CentOS-regression: Gluster Build System <jenkins@build.gluster.org> > Reviewed-by: Joe Julian <me@joejulian.name> Change-Id: I0be0123da68f9d8fbb5d94ede2d45566a9add6a5 BUG: 1350880 Reported-by: Joe Julian <me@joejulian.name> Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/14822 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: jiffin tony Thottan <jthottan@redhat.com>
* gfapi/upcall: Use GF_CALLOC while allocating variablesSoumya Koduri2016-05-251-1/+2
| | | | | | | | | | | | | | | | | | In 'glfs_h_poll_cache_invalidation', use GF_CALLOC to allocate 'up_inode_arg' to set memory accounting which is used/referred when freeing the same variable in case of any erros. This is backport of below mainline fix - http://review.gluster.org/14521 Change-Id: I365e114fa6d7abb292dacb6fc702128d046df8f8 BUG: 1339226 Signed-off-by: Soumya Koduri <skoduri@redhat.com> Reviewed-on: http://review.gluster.org/14522 NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Niels de Vos <ndevos@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
* gfapi: fill iatt in readdirp_cbk if entry->inode is nullMohammed Rafi KC2016-05-231-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | If any of dirent have inode as null in readdirp_cbk, which indicates that the stat information is not valid. So for such entries, we send explicit lookup to fill the stat information. Backport of> >Change-Id: I0604bce34583db0bb04b5aae8933766201c6ddad >BUG: 1330567 >Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> >Reviewed-on: http://review.gluster.org/14079 >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: Niels de Vos <ndevos@redhat.com> (cherry picked from commit 9423bdeed169076ebedd9af40b52aaac58c9839e) Change-Id: I90a218c78d5544a3b49b29079c64a8b76e7939df BUG: 1331263 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> Reviewed-on: http://review.gluster.org/14109 Smoke: Gluster Build System <jenkins@build.gluster.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
* gfapi: set need_lookup flag on response listMohammed Rafi KC2016-05-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We set need_lookup flag for entries returned by readdirp to force lookup. Currently we are setting on the previously stored list, rather than response list returned by readdirp. This patch will iterate over current list returned by readdirp and will set need_lookup flag. Back port of> >Change-Id: Ibd6fcbc188f4c87f40ece7a9dcda27645401c240 >BUG: 1330476 >Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> >Reviewed-on: http://review.gluster.org/14073 >NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> >Reviewed-by: Niels de Vos <ndevos@redhat.com> >Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> >Smoke: Gluster Build System <jenkins@build.gluster.com> >CentOS-regression: Gluster Build System <jenkins@build.gluster.com> (cherry picked from commit 537557da59876536d33cd25a8ef485e7b5fe8849) Change-Id: If7bc0f58e5b8fb261625dc5067a6d330d508ebb1 BUG: 1331264 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> Reviewed-on: http://review.gluster.org/14098 Smoke: Gluster Build System <jenkins@build.gluster.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
* gfapi: clear loc.gfid when retrying after ESTALERaghavendra Talur2016-05-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If an ESTALE is returned as result of a revalidate lookup, it means the previous gfid and inode are to be discarded and lookup has to be tried as a fresh one. A fresh lookup should not have loc.gfid set. We were creating a new inode and passing it down but not clearing loc.gfid. This patch fixes that. >Change-Id: Ib192ada0528b5fb5e49b4e2555f2bcab62710e2d >BUG: 1334444 >Signed-off-by: Raghavendra Talur <rtalur@redhat.com> >Reviewed-on: http://review.gluster.org/14274 >Smoke: Gluster Build System <jenkins@build.gluster.com> >NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> >Reviewed-by: Niels de Vos <ndevos@redhat.com> >CentOS-regression: Gluster Build System <jenkins@build.gluster.com> >Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> >(cherry picked from commit b2f09e531029f573772a09572cee0f8e1855481b) Change-Id: Ib192ada0528b5fb5e49b4e2555f2bcab62710e2d BUG: 1334441 Signed-off-by: Raghavendra Talur <rtalur@redhat.com> Reviewed-on: http://review.gluster.org/14290 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
* libglusterfs/gfapi: set appropriate errno for inode_link failuresSoumya Koduri2016-05-114-8/+18
| | | | | | | | | | | | | | | | | | | | | | We do not seem to be setting errno appropriately in case of inode_link failures. This errno may be used by any application (for eg., nfs-ganesha) to determine the error encountered. This patch addresses the same. This is backport of below mainline fix - http://review.gluster.org/14278 Change-Id: I674f747c73369d0597a9c463e6ea4c85b9091355 BUG: 1335016 Signed-off-by: Soumya Koduri <skoduri@redhat.com> Reviewed-on: http://review.gluster.org/14278 Reviewed-by: Niels de Vos <ndevos@redhat.com> Reviewed-by: jiffin tony Thottan <jthottan@redhat.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.org/14287 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
* gfapi: Fix a deadlock caused by graph switch while aio in progressPoornima G2016-05-061-206/+362
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | RCA: Currently async nature is achieved by submitting a syncop operation to synctask threads. Consider a scenario where the graph switch is triggered, the next write fop checks for the next available graph and sets fs->migration_in_progess and triggers the migration of fds and other things, which can cause some syncop_lookup operation. While this fop (on synctask thread) is waiting for syncop_lookup to return, lets say there are another 17 write async calls submitted, all these writes are blocked waiting for fs->migration_in_progress to be unset, hence all the 16 synctask threads are blocked waiting for fs->migration_in_progress to be unset. Now the syncop_lookup returns, but there are no synctask threads to process the lookup_cbk. If this syncop_lookup doesn't return, then fs->migration_in_progress can not be unset by the first fop. Thus causing a deadlock. To fix this deadlock, changing all the async APIs to use STACK_WIND, instead of syntask to achieve async nature. glfs_preadv_async is already implemented using STACK_WIND, now changing all the other async APIs also to do the same. This patch as such will not reduce the performance of async IO, the only thing that can affect is that, in case of write, the buf passed by application is copied onto iobuf in the same thread wheras before it was being copied in synctask thread. Since, the syncop + graph switch logic (lock across fops) is not a good candidate for synctask, changing the async APIs to use STACK_WIND Backport of http://review.gluster.org/#/c/14148/ Change-Id: Idf665cae0a8e27697fbfc5ec8d93a6d6bae3a4f1 BUG: 1333268 Signed-off-by: Poornima G <pgurusid@redhat.com> Reviewed-on: http://review.gluster.org/14223 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra Talur <rtalur@redhat.com> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
* gfapi/upcall: Ignore handle create failuresSoumya Koduri2016-05-031-24/+118
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | In "glfs_h_poll_cache_invalidation", we need to send upcall only if there is a corresponding inode entry in the gfapi inode table for that handle. That's because the application will have reference to the inode as long as it operates on any handle. That means the only case in which we cannot find inode is when the application has closed the handle (either as part of unlink or for any other purpose). But since it will have no more references and will not be interested in any upcall event for that handle, we can safely ignore such cases. Note: This will affect only that particular applicaiton process/local libgfapi client. This is backport of the below mainline fix - http://review.gluster.org/14132 Change-Id: I9499cd9c284350d4a271e58f2a0966db65a7a61c BUG: 1332433 Signed-off-by: Soumya Koduri <skoduri@redhat.com> Reviewed-on: http://review.gluster.org/14132 Reviewed-by: jiffin tony Thottan <jthottan@redhat.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.org/14181 NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Smoke: Gluster Build System <jenkins@build.gluster.com>
* Revert "glusterd: Bug fixes for IPv6 support"Kaushal M2016-04-161-12/+0
| | | | | | | | This reverts commit b33f3c95ec9c8112e6677e09cea05c4c462040d0. This commit exposes some issues with management encryption that prevents GlusterFS from operating properly. This will be added again once problems with management encryption are fixed.
* gfapi: preserve glfd state during glfs_dupRajesh Joseph2016-03-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Following patch introduced a new state variable in glfd to track the current status of the fd. http://review.gluster.org/13340/ But this state was not copied in glfd_dup function. Backport of commit 5bdfaf98904a339144bf3a237b162e8385b95085: > BUG: 1311146 > Change-Id: I283f8944035f6defe491f81e13d7ef28fc440572 > Signed-off-by: Rajesh Joseph <rjoseph@redhat.com> > Reviewed-on: http://review.gluster.org/13666 > Smoke: Gluster Build System <jenkins@build.gluster.com> > Reviewed-by: Prashanth Pai <ppai@redhat.com> > Tested-by: Prashanth Pai <ppai@redhat.com> > NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> > CentOS-regression: Gluster Build System <jenkins@build.gluster.com> > Reviewed-by: Raghavendra Talur <rtalur@redhat.com> > Reviewed-by: Niels de Vos <ndevos@redhat.com> Change-Id: I283f8944035f6defe491f81e13d7ef28fc440572 BUG: 1317863 Signed-off-by: Rajesh Joseph <rjoseph@redhat.com> Reviewed-on: http://review.gluster.org/13742 NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.com>
* libgfapi: glfd close is not correctly handled for async fopRajesh Joseph2016-03-304-40/+224
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is chance that before the async fop is complete client can send a close. libgfapi destroys glfd on close. Therefore it can lead to crash or unexpected behaviour when the pening fop reaches libgfapi layer. Currently we don't provide any api to cancel these outstanding fops neither we check if the glfd is already closed or not. Therefore as a fix provided refcount for glfd. Each fop (sync or async) will take a ref and once the fop is complete it will unref the refcount. We should not call the registered callback function if glfd is already closed. To achieve this we maintain state of glfd so that we can safely take a call if the fd is closed or not. Backport of commit 88d772c05c45c467bfccebfc51f6a0e0ea9ca287: > Change-Id: Ibe71b2225312db3f1be66b244fcf8826c70c357d > BUG: 1303995 > Signed-off-by: Rajesh Joseph <rjoseph@redhat.com> > Reviewed-on: http://review.gluster.org/13340 > Smoke: Gluster Build System <jenkins@build.gluster.com> > CentOS-regression: Gluster Build System <jenkins@build.gluster.com> > Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> > NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Change-Id: I1e01690ea72f34c12465eb084d7a1aa9de0d7b83 BUG: 1311578 Signed-off-by: Rajesh Joseph <rjoseph@redhat.com> Reviewed-on: http://review.gluster.org/13512 NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.com>
* gfapi: Fix the crashes caused by global_xlator and THISPoornima G2016-03-301-7/+53
| | | | | | | | | | | | | | | | | | | | | | Issue: http://thread.gmane.org/gmane.comp.file-systems.gluster.devel/10922 The right fix for this is elaborate and intrusive, until it is in place, this patch provides a temperory fix. This fix is necessary, as without this libgfapi applications like qemu, samba, NFS ganesha are prone to crashes. This patch will be reverted completely, once the actual fix gets accepted. Credits: Rajesh Joseph, Raghavendra Talur, Anoop CS Back-port of: http://review.gluster.org/#/c/13784/ Change-Id: I8a8a0572bea0eec94ece6aa0d7afcf2f459b4a43 BUG: 1319989 Signed-off-by: Poornima G <pgurusid@redhat.com> Reviewed-on: http://review.gluster.org/13803 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anoop C S <anoopcs@redhat.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
* glusterd: Bug fixes for IPv6 supportNithin D2016-03-211-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Backport of http://review.gluster.org/#/c/11988/ Problem: Glusterd not working using ipv6 transport. The idea is with proper glusterd.vol configuration, 1. glusterd needs to listen on default port (240007) as IPv6 TCP listner. 2. Volume creation/deletion/mounting/add-bricks/delete-bricks/peer-probe needs to work using ipv6 addresses. 3. Bricks needs to listen on ipv6 addresses. All the above functionality is needed to say that glusterd supports ipv6 transport and this is broken. Fix: When "option transport.address-family inet6" option is present in glusterd.vol file, it is made sure that glusterd creates listeners using ipv6 sockets only and also the same information is saved inside brick volume files used by glusterfsd brick process when they are starting. Tests Run: Regression tests using ./run-tests.sh IPv4: Regression tests using ./run-tests.sh for release-3.7 branch verified by comparing with clean repo. IPv6: (Need to add the above mentioned config and also add an entry for "hostname ::1" in /etc/hosts) Started failing at ./tests/basic/glusterd/arbiter-volume-probe.t and ran successfully till here Change-Id: Idd7513aa2347ce0de2b1f68daeecce1b7a39a7af BUG: 1310445 Signed-off-by: Nithin D <nithind1988@yahoo.in> Reviewed-on: http://review.gluster.org/13787 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
* gfapi: return EINVAL for unsupported lseek() operationsNiels de Vos2016-03-091-1/+9
| | | | | | | | | | | | | | | | | | | | GlusterFS 3.8 contains support for SEEK_DATA/SEEK_HOLE. This protocol extension is not available in 3.7. libgfapi needs to handle unsupported SEEK_* operations correctly, by returning -1 and setting errno to EINVAL. This change is different from the patch in the master branch, it is only needed to do the improved error checking in this version. BUG: 1315557 Change-Id: I142dde11923244809b03fcca8cd4c2f7d5ff3929 Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/13631 Smoke: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
* gfapi: Add xlator_cbks fops in gfapiSoumya Koduri2016-02-291-1/+23
| | | | | | | | | | | | | | | | This is backport of the below fix - http://review.gluster.org/13499 Change-Id: I1fe5dd757e65206f92e0a867b43b49a3c0f2d4cf BUG: 1311445 Signed-off-by: Soumya Koduri <skoduri@redhat.com> Reviewed-on: http://review.gluster.org/13499 Reviewed-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-on: http://review.gluster.org/13508 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: Kaleb KEITHLEY <kkeithle@redhat.com>
* gfapi: Use inode_forget in case of handle objectsSoumya Koduri2016-02-271-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently with gfapi, even if applications release their reference on paritular inode entries, those entries never get destroyed as they shall always have positive nlookup count unless inode_table exceeds lru limit. Since inodes and their contexts can consume considerable amount of memory, applications may end up consuming lot of memory and may even get OOM killed. To avoid that, have considered below approaches (for handle based access)- a) Do 'inode_lookup' only if the corresponding inode is created for the first time and forget it during close of the handle This shall not work as multiple handle objects can refer to same inode entry and inode_forget from second handle object onwards shall result in assert. b) Do 'inode_lookup' during a handle or fd creation But this approach shall affect the performance of the fops which operate on neither handle nor fd. c) current approach taken- Applications using glfs handle objects hold a reference on corresponding inode entries. Hence it is safe to forget those inodes and make nlookup count to '0' while trying to delete those handle objects. That way the last unref (i.e, from the last handle close) shall result in inode_destroy(). This is backport of the below patch - http://review.gluster.org/13096 Change-Id: Id2c7ab178894a10c0030c143ba71e7813df8d18c Signed-off-by: Soumya Koduri <skoduri@redhat.com> BUG: 1311441 Reviewed-on: http://review.gluster.org/13096 Reviewed-by: jiffin tony Thottan <jthottan@redhat.com> Reviewed-by: Niels de Vos <ndevos@redhat.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.org/13506 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
* gfapi: send lookup if inode_ctx is not setMohammed Rafi KC2016-02-273-5/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | During resolving of an entry or inode, if inode ctx was not set, we will send a lookup to pupulate inode ctx for every xlators This patch also make sure that inode_ctx will be created after every inode_link. We will store inode_ctx value as LOOKUP_NEEDED if the inode is liked via readdirp, in all other case we will store inode_ctx value as LOOKUP_NOT_NEEDED. Back port of> >Change-Id: I3a10c298944200fa3862127187ae8988e582d352 >BUG: 1297311 >Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> >Reviewed-on: http://review.gluster.org/13226 >Reviewed-by: Poornima G <pgurusid@redhat.com> >Tested-by: NetBSD Build System <jenkins@build.gluster.org> >Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> >Reviewed-by: Dan Lambright <dlambrig@redhat.com> >Tested-by: Dan Lambright <dlambrig@redhat.com> Change-Id: Ifeabb5611fcaa3c41404f0cdc48a680a16600e68 BUG: 1306131 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> Reviewed-on: http://review.gluster.org/13414 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Poornima G <pgurusid@redhat.com> Reviewed-by: Dan Lambright <dlambrig@redhat.com>
* gfapi : fixing listxattr call for handle opsJiffin Tony Thottan2016-02-251-11/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | Currently listxattr is called as part of glfs_h_getxattrs() when NULL is passed to name field, but glfs_h_getxattrs_common() inside it will error out if name is NULL. Therefore listxattr is broken for handle ops. Upstream reference >Change-Id: I9ced6e33525e1e1a50298972e4922c954fc2b223 >BUG: 1310620 >Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> >Reviewed-on: http://review.gluster.org/13482 >Reviewed-by: Niels de Vos <ndevos@redhat.com> >Smoke: Gluster Build System <jenkins@build.gluster.com> >NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> >CentOS-regression: Gluster Build System <jenkins@build.gluster.com> >(cherry picked from commit 0bc54f3ea7a56040df4a67b8626200b47fa3d779) Change-Id: Ib88c12e5c2a1841e96a65e672f40b44ac9f491a9 BUG: 1311411 Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> Reviewed-on: http://review.gluster.org/13504 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
* api: Fix errno being set to EINVAL even on successPrashanth Pai2016-02-231-0/+2
| | | | | | | | | | | | | | | | | BUG: 1296007 Change-Id: I7905ac70a537f23e1844c097a24eaa6cb762fb82 Signed-off-by: Prashanth Pai <ppai@redhat.com> Reviewed-on: http://review.gluster.org/12909 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: jiffin tony Thottan <jthottan@redhat.com> Reviewed-by: Kaushal M <kaushal@redhat.com> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> Reviewed-on: http://review.gluster.org/13179 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
* Upcall: Read gfid from iatt in case of invalid inodeSoumya Koduri2015-12-031-0/+4
| | | | | | | | | | | | | | | | | | | | When any file/dir is looked upon for the first time, inode created shall be invalid till it gets linked to the inode table. In such cases, read the gfid from the iatt structure returned as part of such fops for UPCALL processing. This is backport of the below patch - http://review.gluster.org/12773 Change-Id: Ie5eb2f3be18c34cf7ef172e126c9db5ef7a8512b BUG: 1287079 Signed-off-by: Soumya Koduri <skoduri@redhat.com> Reviewed-on: http://review.gluster.org/12773 Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/12839 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com>
* libgfapi: To support set_volfile-server-transport type "unix"Mohamed Ashiq2015-12-023-13/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch helps libgfapi to get the volfile using Unix domain socket. run the attachment file in the bug to test. The patch checks if the glfs_set_volfile_server transport is of type "unix", If It is then uses rpc_transport_unix_options_build to get the volfile. Signed-off-by: Mohamed Ashiq <mliyazud@redhat.com> Signed-off-by: Humble Devassy Chirammal <hchiramm@redhat.com> >Change-Id: Ifd5d1e7c0d8cc9a906c3c3355b8977141e892a2f >BUG: 1279739 >Signed-off-by: Mohamed Ashiq <mliyazud@redhat.com> >Signed-off-by: Humble Devassy Chirammal <hchiramm@redhat.com> >Reviewed-on: http://review.gluster.org/12563 >Tested-by: NetBSD Build System <jenkins@build.gluster.org> >Tested-by: Gluster Build System <jenkins@build.gluster.com> >Reviewed-by: Niels de Vos <ndevos@redhat.com> >Reviewed-by: Poornima G <pgurusid@redhat.com> >Reviewed-by: Raghavendra Talur <rtalur@redhat.com> >Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> Change-Id: I0b3f2023e6698366d8c20d6574f5de7b8a641f30 BUG: 1283038 Reviewed-on: http://review.gluster.org/12645 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
* gfapi: xattr key length check to avoid brick crashMilind Changire2015-11-092-0/+70
| | | | | | | | | | | | | | | | | | | | | | | | | Added check to test if xattr key length > max allowed for OS distribution and return: EINVAL if xattr name pointer is NULL or 0 length ENAMETOOLONG if xattr name length > max allowed for distribution Function exit path for invalid input is via label "out:" for mandatory __GLFS_EXIT_FS. Typically the VFS does this in the kernel for us. But since we are bypassing the VFS by providing the libgfapi to talk directly to the brick process, we need to add such checks. Change-Id: I610a8440871200ae4640351902b752777a3ec0c2 BUG: 1272926 Signed-off-by: Milind Changire <mchangir@redhat.com> Reviewed-on: http://review.gluster.org/12207 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org> (cherry picked from commit 47d8d2fc9c88c95dfcae2c5c06e6eb3b1ce03a92) Reviewed-on: http://review.gluster.org/12387 Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
* libgfapi : port missing gf_log's to gf_msgManikandan Selvaganesh2015-08-313-11/+13
| | | | | | | | | | | | | | | | | | | | | | | Backport of http://review.gluster.org/#/c/11891/ Cherry-picked from commit 1e0644031c7ac0fa28f0912e951a9238f7bbe8ab > Change-Id: I0c5320c09b4a5ff1e9df61a86ac7bd47c1bb1bbb > BUG: 1252807 > Signed-off-by: Manikandan Selvaganesh <mselvaga@redhat.com> > Reviewed-on: http://review.gluster.org/11891 > Tested-by: NetBSD Build System <jenkins@build.gluster.org> > Reviewed-by: Raghavendra Talur <rtalur@redhat.com> > Reviewed-by: jiffin tony Thottan <jthottan@redhat.com> > Reviewed-by: Humble Devassy Chirammal <humble.devassy@gmail.com> > Reviewed-by: Raghavendra G <rgowdapp@redhat.com> Change-Id: I0c5320c09b4a5ff1e9df61a86ac7bd47c1bb1bbb BUG: 1258406 Signed-off-by: Manikandan Selvaganesh <mselvaga@redhat.com> Reviewed-on: http://review.gluster.org/12063 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
* libgfapi: Gracefully exit when glfd is invalidPrashanth Pai2015-08-262-4/+6
| | | | | | | | | | | | | | | | | | | | | | This is a backport of: http://review.gluster.org/10759 When glfs_* methods operating on glfd are invoked after calling glfs_close(), the program segfaults inside __GLFS_ENTRY_VALIDATE_FD trying to deference glfd->fd->inode which is invalid. Also, returning EBADF seemed more specific than EINVAL. BUG: 1240920 Change-Id: I13a92dca52da9a300252b69e026581b3a9e931fd Signed-off-by: Prashanth Pai <ppai@redhat.com> Reviewed-on-master: http://review.gluster.org/10759 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> Reviewed-on: http://review.gluster.org/11571 Reviewed-by: Niels de Vos <ndevos@redhat.com> Reviewed-by: Humble Devassy Chirammal <humble.devassy@gmail.com> Reviewed-by: bipin kunal <bkunal@redhat.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org>
* libgfapi: adding 'follow' flag to glfs_h_lookupat()Jiffin Tony Thottan2015-08-255-27/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is backport of http://review.gluster.org/#/c/11883/ Previously glfs_h_lookupat won't follow the symlink, this patch introduces new flag `follow` which will resolve the same. Applications linking against the new library will need to use the new glfs_h_lookupat API call. In order to stay compatible with existing binaries that use the previous glfs_h_lookupat() function, the old symbol needs to stay available. Verification that there are two versions of glfs_h_lookupat: $ objdump -T /usr/lib64/libgfapi.so.0 | grep -w glfs_h_lookupat 0000000000015070 g DF .text 000000000000021e GFAPI_3.7.4 glfs_h_lookupat 0000000000015290 g DF .text 0000000000000008 (GFAPI_3.4.2) glfs_h_lookupat Testing with a binary (based on anonymous_fd_read_write.c from ./tests/) that was linked against the old library: $ objdump -T ./lookupat | grep -w glfs_h_lookupat 0000000000000000 DF *UND* 0000000000000000 GFAPI_3.4.2 glfs_h_lookupat Enable debugging for 'ld.so' so that we can check that the GFAPI_3.4.2 version of the symbol gets loaded: $ export LD_DEBUG_OUTPUT=lookupat.ld.log LD_DEBUG=all $ ./lookupat $ grep -w glfs_h_lookupat lookupat.ld.log.2543 2543: symbol=glfs_h_lookupat; lookup in file=./lookupat [0] 2543: symbol=glfs_h_lookupat; lookup in file=/lib64/libgfapi.so.0 [0] 2543: binding file ./lookupat [0] to /lib64/libgfapi.so.0 [0]: normal symbol `glfs_h_lookupat' [GFAPI_3.4.2] This change has been successfully cherry-picked as 1ead86a8bcbfe4045729466e4b98f765f3c13c8d in master Upstream reference >Change-Id: I8bf9b1c19a0585f681bc1a7f84aad1ccd0f75f6a >BUG: 1252410 >Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> >Signed-off-by: Niels de Vos <ndevos@redhat.com> >Reviewed-on: http://review.gluster.org/11883 >Reviewed-by: soumya k <skoduri@redhat.com> >Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> >Tested-by: NetBSD Build System <jenkins@build.gluster.org> Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> Change-Id: Idbbf0cd6802f86c53b16377d90d08ff6d99e7b08 BUG: 1256616 Reviewed-on: http://review.gluster.org/12009 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
* libgfapi: non-default symbol version macros are incorrectKaleb S. KEITHLEY2015-08-191-2/+2
| | | | | | | | | | | | | | | | | | | default symbol versions are in form glfs_h_lookupat@@GFAPI_2.7.4, versus old, non-default versions are in the form glfs_h_lookup@GFAPI_2.4.2 I.e. "@@" versus "@" Backport of: * Change-Id: I88a6b129558c0b3a6064de7620b3b20425e80bc9 * BUG: 1254863 * http://review.gluster.org/#/c/11955/ Change-Id: I0d53140e03dc2f501ce11d5b2d67373360f2b8b2 BUG: 1254865 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.org/11956 Reviewed-by: Niels de Vos <ndevos@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
* rpc: add owner xlator argument to rpc_clnt_newKrishnan Parthasarathi2015-08-142-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The @owner argument tells RPC layer the xlator that owns the connection and to which xlator THIS needs be set during network notifications like CONNECT and DISCONNECT. Code paths that originate from the head of a (volume) graph and use STACK_WIND ensure that the RPC local endpoint has the right xlator saved in the frame of the call (callback pair). This guarantees that the callback is executed in the right xlator context. The client handshake process which includes fetching of brick ports from glusterd, setting lk-version on the brick for the session, don't have the correct xlator set in their frames. The problem lies with RPC notifications. It doesn't have the provision to set THIS with the xlator that is registered with the corresponding RPC programs. e.g, RPC_CLNT_CONNECT event received by protocol/client doesn't have THIS set to its xlator. This implies, call(-callbacks) originating from this thread don't have the right xlator set too. The fix would be to save the xlator registered with the RPC connection during rpc_clnt_new. e.g, protocol/client's xlator would be saved with the RPC connection that it 'owns'. RPC notifications such as CONNECT, DISCONNECT, etc inherit THIS from the RPC connection's xlator. Change-Id: I9dea2c35378c511d800ef58f7fa2ea5552f2c409 BUG: 1253212 Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com> Reviewed-on: http://review.gluster.org/11436 Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Raghavendra G <rgowdapp@redhat.com> (cherry picked from commit f7668938cd7745d024f3d2884e04cd744d0a69ab) Reviewed-on: http://review.gluster.org/11908 Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
* syncop: Include iatt to 'syncop_link' argsSoumya Koduri2015-07-152-5/+5
| | | | | | | | | | | | | | | | | Include iatt to 'syncop_link' args to fetch proper attributes of the newly linked inode. This is backport of the below fix - http://review.gluster.org/11611 Change-Id: If6b92961bd7a89add3791ed3a9b494087348b492 BUG: 1243408 Reviewed-on: http://review.gluster.org/11611 Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Signed-off-by: Soumya Koduri <skoduri@redhat.com> Reviewed-on: http://review.gluster.org/11677 Tested-by: Gluster Build System <jenkins@build.gluster.com>
* gfapi: Update loc->inode accordingly in 'glfs_loc_link'Soumya Koduri2015-07-102-15/+11
| | | | | | | | | | | | | | | | | | | In case if the inode already exits in the cache, inode_link returns the pointer to the exiting one instead of using loc->inode. This will result in issues if that invalid inodei(loc->inode) is referenced further. Fixed the same. This is backport of the below fix - http://review.gluster.org/#/c/11572/ BUG: 1241666 Change-Id: I1a89932397f7d2b70d619eeaf862c0a5d7f6b91c Signed-off-by: Soumya Koduri <skoduri@redhat.com> Reviewed-on: http://review.gluster.org/11572 Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> Reviewed-on: http://review.gluster.org/11606 Tested-by: Gluster Build System <jenkins@build.gluster.com>
* libgfapi: send explicit lookups on inodes linked in readdirpRaghavendra Bhat2015-07-062-14/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Backport of http://review.gluster.org/11236 If the inode is linked via readdirp, then the consuners of gfapi which are using handles (got either in lookup or readdirp) might not send an explicit lookup on that object again (ex: NFS, samba, USS). If there is a replicate volume where the replicas of the object are not in sync, then readdirp followed by fops might lead data being served from the subvolume which is not in sync with latest data. And since lookup is needed to trigger self-heal on that object the consumers might keep getting wrong data until an explicit lookup is not done. Fuse handles this situation by sending an explicit lookup by itself (fuse xlator) on those inodes which are linked via readdirp, whenever a fop comes on that inode. The same procedure is done in gfapi as well to address this situation. Thanks to shyam(srangana@redhat.com) for valuable inputs Change-Id: I4230fae8e0b01a95c056282b08ed30832d4804a7 BUG: 1240190 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com> Reviewed-on: http://review.gluster.org/11545 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
* gfapi : symlink resolution for glfs_objectJiffin Tony Thottan2015-06-283-2/+63
| | | | | | | | | | | | | | | | | | | | Generally posix expects symlink should be resolved, before performing an acl related operation. This patch introduces a new api glfs_h_resolve_symlink() which will do the same. backport of http://review.gluster.org/#/c/11410/1 >Change-Id: Ieee645154455a732edfb2c28834021bab4248810 >BUG: 1209735 >Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> Change-Id: I13a83f37a9e59418fd8eb4bf2d44f828515beabf BUG: 1236269 Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> Reviewed-on: http://review.gluster.org/11438 Reviewed-by: Niels de Vos <ndevos@redhat.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org> Tested-by: Gluster Build System <jenkins@build.gluster.com>
* libgfapi: introduce bit flags for pthread mutex and cond variablesHumble Devassy Chirammal2015-06-222-73/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At present stage, the initialization and destroy of conditional and mutex variables of glfs struct happen in different places and there is no uniform way of destroying these variables incase there is a failure when initializing these. The fs mutex and conditional variables are getting destroyed from glfs_free_from_ctx(). However this destroy is not done by a conditional check inside destroy function. By introducing bit flags in glfs object, we can make use of the same (if there is a failure in initialization) in glfs_fini() which is evolving as one and only function to free fs and ctx resources. This patch introduce the flags field and set the flags according to the initialization flow of the mutex and conditional variables of struct glfs members. Without this patch we are compelled to use the goto lables and other hacks in init functions to make sure the resources are freed if there is an error path. Change-Id: I86e2719fb7ce437419a05699b4f06c14b02d0e69 BUG: 1233651 Signed-off-by: Humble Devassy Chirammal <hchiramm@redhat.com> Signed-off-by: Poornima G <pgurusid@redhat.com> Reviewed-on: http://review.gluster.org/10120 Reviewed-by: Niels de Vos <ndevos@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> (cherry picked from commit bc858473db1e1091b15d3f3d69ac6ba5d20b58e7) Reviewed-on: http://review.gluster.org/10971 Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
* gfapi: zero size issue in glfs_h_acl_set()Niels de Vos2015-06-011-2/+2
| | | | | | | | | | | | | | | | | | | When setting the stringified ACLs in the xattr dict through pub_glfs_h_setxattrs(), the size of the string is always passed as 0. The correct way is to pass the length of the ACL in text form. Backport of: > Change-Id: Ia7a7fa1f3a7d615a813c703057dc97b09a0bbb34 > BUG: 789278 > Reviewd-on: http://review.gluster.org/10782 > Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> Change-Id: Ia7a7fa1f3a7d615a813c703057dc97b09a0bbb34 BUG: 1224241 Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/10890 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
* gfapi: fix compile warning in pub_glfs_h_access()Niels de Vos2015-05-091-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While compiling libgfapi, the following warning is reported: Making all in src CC libgfapi_la-glfs-handleops.lo In file included from glfs-handleops.c:12:0: glfs-handleops.c: In function 'pub_glfs_h_access': glfs-internal.h:216:14: warning: 'old_THIS' may be used uninitialized in this function [-Wmaybe-uninitialized] THIS = old_THIS; \ ^ glfs-internal.h:202:36: note: 'old_THIS' was declared here #define DECLARE_OLD_THIS xlator_t *old_THIS = NULL ^ glfs-handleops.c:1159:2: note: in expansion of macro 'DECLARE_OLD_THIS' DECLARE_OLD_THIS; ^ CCLD libgfapi.la CCLD api.la The DECLARE_OLD_THIS macro should be done with the declarations of all the other variables used in this function. Moving the macro further up in the function prevents this warning. Backport of: > Change-Id: I2bedc1aa074893ae3e2c933abc5a167ab5b55f41 > BUG: 1210934 > Reviewed-on: http://review.gluster.org/10728 > Reported-by: Shyamsundar Ranganathan <srangana@redhat.com> > Signed-off-by: Niels de Vos <ndevos@redhat.com> Change-Id: I2bedc1aa074893ae3e2c933abc5a167ab5b55f41 BUG: 1215787 Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/10730 Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
* core: use reference counting for mem_acct structuresJeff Darcy2015-05-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When freeing memory, our memory-accounting code expects to be able to dereference from the (previously) allocated block to its owning translator. However, as we have already found once in option validation and twice in logging, that translator might itself have been freed and the dereference attempt causes on of our daemons to crash with SIGSEGV. This patch attempts to fix that as follows: * We no longer embed a struct mem_acct directly in a struct xlator, but instead allocate it separately. * Allocated memory blocks now contain a pointer to the mem_acct instead of the xlator. * The mem_acct structure contains a reference count, manipulated in both the normal and translator allocate/free code using atomic increments and decrements. * Because it's now a separate structure, we can defer freeing the mem_acct until its reference count reaches zero (either way). * Some unit tests were disabled, because they embedded their own copies of the implementation for what they were supposedly testing. Life's too short to spend time fixing tests that seem designed to impede progress by requiring a certain implementation as well as behavior. Change-Id: Id929b11387927136f78626901729296b6c0d0fd7 BUG: 1219026 Signed-off-by: Jeff Darcy <jdarcy@redhat.com> Reviewed-on: http://review.gluster.org/10417 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Reviewed-by: Niels de Vos <ndevos@redhat.com> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/10723 Tested-by: NetBSD Build System
* libgfapi: Store and restore THIS in every API exposed by libgfapiPoornima G2015-05-095-145/+591
| | | | | | | | | | | | | | | | | | | | | | | | | | | Backport of http://review.gluster.org/#/c/9797 Storing and restoring THIS: When the APIs exposed by libgfapi are called by other xlators like snapview server etc. the THIS value is overwritten to contain the THIS of libgfapi(viz libgfapi master xlator). Hence using 'THIS' in any xlator after calling libgfapi API will lead to issues. One such issue was uncovered in snapview and the patch http://review.gluster.org/#/c/9469/ was sent to workaround this issue. Hence, storing and restoring THIS, at the entry and exit of every API exposed by libgfapi. Change-Id: I6f330dde25e7700fb26339d667a7ccd193ec6ba0 BUG: 1210934 Signed-off-by: Poornima G <pgurusid@redhat.com> Reviewed-on: http://review.gluster.org/9797 Reviewed-by: Raghavendra Talur <rtalur@redhat.com> Reviewed-by: soumya k <skoduri@redhat.com> Reviewed-by: Niels de Vos <ndevos@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> (cherry picked from commit 1162bb36108ab8dba8303b86927a99835b791d79) Reviewed-on: http://review.gluster.org/10414 Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
* libgfapi : anonymous fd supportJiffin Tony Thottan2015-05-076-0/+227
| | | | | | | | | | | | | | | | | | | | | | | | | | | backport of http://review.gluster.org/#/c/9971/ Anonymous fd's are floating fd assigned to a glusterfs client without a explicit file open. Here either it will create a new anonymous fd or existing anonymous fd in the client stack for requested file.The anonymous fd's are mainly used for IO's. This patch introduces two api's glfs_h_anonymous_read and glfs_h_anonymous_write which performs read and write respectively cherry-picked as fa0ad231745846918b2625d0e1a89c0a5c3c24dc >Change-Id: Id646f2220e8387b2f8bb244c848dc1db6761444f >BUG: 1204651 >Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> >Reviewed-by: Niels de Vos <ndevos@redhat.com> >Reviewed-on: http://review.gluster.org/9971 >Tested-by: Gluster Build System <jenkins@build.gluster.com> >Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> Change-Id: I6b01d88f92ad045e48debee23aa79f4517c6bdc2 BUG: 1218857 Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com> Reviewed-on: http://review.gluster.org/10635 Reviewed-by: Niels de Vos <ndevos@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
* Upcall: Send stat as part of cache_invalidation notificationsSoumya Koduri2015-05-074-39/+134
| | | | | | | | | | | | | | | | | Have added support to send attributes of both entries and its parent (include oldparent in case of RENAME fop) in the same notification request to avoid multiple rpc requests. Also, made changes in gfapi to send parent object and its attributes changed in a single upcall event. Change-Id: I92833da3bcec38d65216921c2ce4d10367c32ef1 BUG: 1217711 Signed-off-by: Soumya Koduri <skoduri@redhat.com> Reviewed-on: http://review.gluster.org/10568 Tested-by: NetBSD Build System Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
* gfapi: Skip and delete the upcall entry if not foundSoumya Koduri2015-05-071-20/+32
| | | | | | | | | | | | | | | We could run into situations where in gfapi received a upcall notification for a file and the file may have got deleted by then. Hence, incase of error while trying to create handle from gfid, log it, delete the entry and return with CBK_NULL reason. Change-Id: I191f10f44d6804be07734a6be63a3ca08f455f0e BUG: 1218566 Signed-off-by: Soumya Koduri <skoduri@redhat.com> Reviewed-on: http://review.gluster.org/10341 Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.org/10565 Tested-by: NetBSD Build System
* Upcall: Process each of the upcall events separatelySoumya Koduri2015-05-075-35/+96
| | | | | | | | | | | | | | | | | | As suggested during the code-review of Bug1200262, have modified GF_CBK_UPCALL to be exlusively GF_CBK_CACHE_INVALIDATION. Thus, for any new upcall event, a new CBK procedure will be added. Also made changes to store upcall data separately based on the upcall event type received. BUG: 1217711 Change-Id: I0f5e53d6f5ece16aecb514a0a426dca40fa1c755 Signed-off-by: Soumya Koduri <skoduri@redhat.com> Reviewed-on: http://review.gluster.org/10049 Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Reviewed-on: http://review.gluster.org/10562 Tested-by: NetBSD Build System Tested-by: Gluster Build System <jenkins@build.gluster.com>
* libgfapi : port gfapi to new logging frameworkHumble Devassy Chirammal2015-05-077-92/+254
| | | | | | | | | | | | | | | | | | | | | | | | | | This also contains backport of http://review.gluster.org/10456: - Fix ENOKEY build failure on non Linux systems Cherry picked from commit 8986a47c54db4769feb4e6664532386f1cd0275d: > Change-Id: Iaa0a92f82b9a0a26eda1a8d72b3b66ce66fab443 > BUG: 1194640 > Signed-off-by: Humble Devassy Chirammal <hchiramm@redhat.com> > Reviewed-on: http://review.gluster.org/9918 > Tested-by: Gluster Build System <jenkins@build.gluster.com> > Reviewed-by: jiffin tony Thottan <jthottan@redhat.com> > Reviewed-by: Raghavendra Talur <rtalur@redhat.com> > Reviewed-by: soumya k <skoduri@redhat.com> > Reviewed-by: Niels de Vos <ndevos@redhat.com> Signed-off-by: Humble Devassy Chirammal <hchiramm@redhat.com> Change-Id: I320b4f1268d49a1a1086412ff2a9fb815bcf1cf4 BUG: 1217722 Change-Id: I320b4f1268d49a1a1086412ff2a9fb815bcf1cf4 Reviewed-on: http://review.gluster.org/10486 Tested-by: NetBSD Build System Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: jiffin tony Thottan <jthottan@redhat.com>