diff options
author | Niels de Vos <ndevos@redhat.com> | 2017-08-01 14:41:22 +0200 |
---|---|---|
committer | Shyamsundar Ranganathan <srangana@redhat.com> | 2017-08-02 15:04:10 +0000 |
commit | 64391ea321d269671814afd13cbdfe099b893e4d (patch) | |
tree | ee02983b97fd8d3fd645a58d99e1d37169d01daf /libglusterfs | |
parent | a0ed5141f8cfc4d56a6309adfc6ca1d35de3df00 (diff) |
libglusterfs: the global_xlator should have valid cbks
There is a case where Gluster/NFS needs to resolve a path outside of the
nfs-xlator itself. While resolving the path to fetch the GFID for
creating the NFS-filehandle, gfapi may set an inode-ctx through
glfs_resolve_at(). This inode-ctx is linked with the global_xlator.
Because the global_xlator does not have any cbks, loc_wipe() will cause
a segfault when it calls inode_unref() and xl->cbks->forget(). It is
assumed that all xlators have a cbks symbol, otherwise loading of the
xlator will fail. The global_xlator is not loaded in the same way, so
there is no failure noticed when the instance is created. By adding an
empty `struct xlator_cbks`, the global_xlator behaves similat to other
xlators that do not implement all callbacks.
I would have preferred to keep the inode-ctx setting through
glfs_resolve_at() contained within Gluster/NFS. Unfortunately
Gluster/NFS also uses the inode-ctx, and is not prepared to see the
values that glfs_resolve_at() stores there.
This problem is not easily reproducible because it involves mounting
over WebNFS (like Solaris 10 can do). The segfault will also not be
immediate, unless the following is done:
1. create a subdir on a volume
2. mount the volume/subdir over WebNFS
3. unmount the volume/subdir
4. mount the root of the volume
5. delete the subdir on the volume -> segfault of Gluster/NFS
Cherry picked from commit cec5036f7e99ae265bb5e0e7f3df30166466eb2c:
> Change-Id: I2bd71d033e97edc07ba93b2d4ada558f65d68999
> BUG: 1468291
> Signed-off-by: Niels de Vos <ndevos@redhat.com>
> Reviewed-on: https://review.gluster.org/17897
> Smoke: Gluster Build System <jenkins@build.gluster.org>
> Reviewed-by: Amar Tumballi <amarts@redhat.com>
> Reviewed-by: jiffin tony Thottan <jthottan@redhat.com>
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
> Reviewed-by: Jeff Darcy <jeff@pl.atyp.us>
Change-Id: I2bd71d033e97edc07ba93b2d4ada558f65d68999
BUG: 1477190
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: https://review.gluster.org/17946
Smoke: Gluster Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r-- | libglusterfs/src/globals.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libglusterfs/src/globals.c b/libglusterfs/src/globals.c index c537971cbb4..0ac1ab9b65b 100644 --- a/libglusterfs/src/globals.c +++ b/libglusterfs/src/globals.c @@ -125,6 +125,17 @@ glusterfs_this_destroy (void *ptr) FREE (ptr); } +static struct xlator_cbks global_cbks = { + .forget = NULL, + .release = NULL, + .releasedir = NULL, + .invalidate = NULL, + .client_destroy = NULL, + .client_disconnect = NULL, + .ictxmerge = NULL, + .ictxsize = NULL, + .fdctxsize = NULL, +}; int glusterfs_this_init () @@ -141,6 +152,7 @@ glusterfs_this_init () global_xlator.name = "glusterfs"; global_xlator.type = "global"; + global_xlator.cbks = &global_cbks; INIT_LIST_HEAD (&global_xlator.volume_options); |