"Fossies" - the Fresh Open Source Software Archive

Member "glusterfs-8.2/xlators/features/snapview-server/src/snapview-server-helpers.c" (16 Sep 2020, 17262 Bytes) of package /linux/misc/glusterfs-8.2.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "snapview-server-helpers.c" see the Fossies "Dox" file reference documentation.

    1 /*
    2    Copyright (c) 2014 Red Hat, Inc. <http://www.redhat.com>
    3    This file is part of GlusterFS.
    4 
    5    This file is licensed to you under your choice of the GNU Lesser
    6    General Public License, version 3 or any later version (LGPLv3 or
    7    later), or the GNU General Public License, version 2 (GPLv2), in all
    8    cases as published by the Free Software Foundation.
    9 */
   10 #include "snapview-server.h"
   11 #include "snapview-server-mem-types.h"
   12 
   13 #include <glusterfs/xlator.h>
   14 #include "rpc-clnt.h"
   15 #include "xdr-generic.h"
   16 #include "protocol-common.h"
   17 #include <pthread.h>
   18 
   19 int
   20 __svs_inode_ctx_set(xlator_t *this, inode_t *inode, svs_inode_t *svs_inode)
   21 {
   22     uint64_t value = 0;
   23     int ret = -1;
   24 
   25     GF_VALIDATE_OR_GOTO("snapview-server", this, out);
   26     GF_VALIDATE_OR_GOTO(this->name, inode, out);
   27     GF_VALIDATE_OR_GOTO(this->name, svs_inode, out);
   28 
   29     value = (uint64_t)(long)svs_inode;
   30 
   31     ret = __inode_ctx_set(inode, this, &value);
   32 
   33 out:
   34     return ret;
   35 }
   36 
   37 svs_inode_t *
   38 __svs_inode_ctx_get(xlator_t *this, inode_t *inode)
   39 {
   40     svs_inode_t *svs_inode = NULL;
   41     uint64_t value = 0;
   42     int ret = -1;
   43 
   44     GF_VALIDATE_OR_GOTO("snapview-server", this, out);
   45     GF_VALIDATE_OR_GOTO(this->name, inode, out);
   46 
   47     ret = __inode_ctx_get(inode, this, &value);
   48     if (ret)
   49         goto out;
   50 
   51     svs_inode = (svs_inode_t *)((long)value);
   52 
   53 out:
   54     return svs_inode;
   55 }
   56 
   57 svs_inode_t *
   58 svs_inode_ctx_get(xlator_t *this, inode_t *inode)
   59 {
   60     svs_inode_t *svs_inode = NULL;
   61 
   62     GF_VALIDATE_OR_GOTO("snapview-server", this, out);
   63     GF_VALIDATE_OR_GOTO(this->name, inode, out);
   64 
   65     LOCK(&inode->lock);
   66     {
   67         svs_inode = __svs_inode_ctx_get(this, inode);
   68     }
   69     UNLOCK(&inode->lock);
   70 
   71 out:
   72     return svs_inode;
   73 }
   74 
   75 int32_t
   76 svs_inode_ctx_set(xlator_t *this, inode_t *inode, svs_inode_t *svs_inode)
   77 {
   78     int32_t ret = -1;
   79 
   80     GF_VALIDATE_OR_GOTO("snapview-server", this, out);
   81     GF_VALIDATE_OR_GOTO(this->name, inode, out);
   82     GF_VALIDATE_OR_GOTO(this->name, svs_inode, out);
   83 
   84     LOCK(&inode->lock);
   85     {
   86         ret = __svs_inode_ctx_set(this, inode, svs_inode);
   87     }
   88     UNLOCK(&inode->lock);
   89 
   90 out:
   91     return ret;
   92 }
   93 
   94 svs_inode_t *
   95 svs_inode_new(void)
   96 {
   97     svs_inode_t *svs_inode = NULL;
   98 
   99     svs_inode = GF_CALLOC(1, sizeof(*svs_inode), gf_svs_mt_svs_inode_t);
  100 
  101     return svs_inode;
  102 }
  103 
  104 svs_inode_t *
  105 svs_inode_ctx_get_or_new(xlator_t *this, inode_t *inode)
  106 {
  107     svs_inode_t *svs_inode = NULL;
  108     int ret = -1;
  109 
  110     GF_VALIDATE_OR_GOTO("snapview-server", this, out);
  111     GF_VALIDATE_OR_GOTO(this->name, inode, out);
  112 
  113     LOCK(&inode->lock);
  114     {
  115         svs_inode = __svs_inode_ctx_get(this, inode);
  116         if (!svs_inode) {
  117             svs_inode = svs_inode_new();
  118             if (svs_inode) {
  119                 ret = __svs_inode_ctx_set(this, inode, svs_inode);
  120                 if (ret) {
  121                     GF_FREE(svs_inode);
  122                     svs_inode = NULL;
  123                 }
  124             }
  125         }
  126     }
  127     UNLOCK(&inode->lock);
  128 
  129 out:
  130     return svs_inode;
  131 }
  132 
  133 svs_fd_t *
  134 svs_fd_new(void)
  135 {
  136     svs_fd_t *svs_fd = NULL;
  137 
  138     svs_fd = GF_CALLOC(1, sizeof(*svs_fd), gf_svs_mt_svs_fd_t);
  139 
  140     return svs_fd;
  141 }
  142 
  143 int
  144 __svs_fd_ctx_set(xlator_t *this, fd_t *fd, svs_fd_t *svs_fd)
  145 {
  146     uint64_t value = 0;
  147     int ret = -1;
  148 
  149     GF_VALIDATE_OR_GOTO("snapview-server", this, out);
  150     GF_VALIDATE_OR_GOTO(this->name, fd, out);
  151     GF_VALIDATE_OR_GOTO(this->name, svs_fd, out);
  152 
  153     value = (uint64_t)(long)svs_fd;
  154 
  155     ret = __fd_ctx_set(fd, this, value);
  156 
  157 out:
  158     return ret;
  159 }
  160 
  161 svs_fd_t *
  162 __svs_fd_ctx_get(xlator_t *this, fd_t *fd)
  163 {
  164     svs_fd_t *svs_fd = NULL;
  165     uint64_t value = 0;
  166     int ret = -1;
  167 
  168     GF_VALIDATE_OR_GOTO("snapview-server", this, out);
  169     GF_VALIDATE_OR_GOTO(this->name, fd, out);
  170 
  171     ret = __fd_ctx_get(fd, this, &value);
  172     if (ret)
  173         return NULL;
  174 
  175     svs_fd = (svs_fd_t *)((long)value);
  176 
  177 out:
  178     return svs_fd;
  179 }
  180 
  181 svs_fd_t *
  182 svs_fd_ctx_get(xlator_t *this, fd_t *fd)
  183 {
  184     svs_fd_t *svs_fd = NULL;
  185 
  186     GF_VALIDATE_OR_GOTO("snapview-server", this, out);
  187     GF_VALIDATE_OR_GOTO(this->name, fd, out);
  188 
  189     LOCK(&fd->lock);
  190     {
  191         svs_fd = __svs_fd_ctx_get(this, fd);
  192     }
  193     UNLOCK(&fd->lock);
  194 
  195 out:
  196     return svs_fd;
  197 }
  198 
  199 int32_t
  200 svs_fd_ctx_set(xlator_t *this, fd_t *fd, svs_fd_t *svs_fd)
  201 {
  202     int32_t ret = -1;
  203 
  204     GF_VALIDATE_OR_GOTO("snapview-server", this, out);
  205     GF_VALIDATE_OR_GOTO(this->name, fd, out);
  206     GF_VALIDATE_OR_GOTO(this->name, svs_fd, out);
  207 
  208     LOCK(&fd->lock);
  209     {
  210         ret = __svs_fd_ctx_set(this, fd, svs_fd);
  211     }
  212     UNLOCK(&fd->lock);
  213 
  214 out:
  215     return ret;
  216 }
  217 
  218 svs_fd_t *
  219 __svs_fd_ctx_get_or_new(xlator_t *this, fd_t *fd)
  220 {
  221     svs_fd_t *svs_fd = NULL;
  222     int ret = -1;
  223     glfs_t *fs = NULL;
  224     glfs_object_t *object = NULL;
  225     svs_inode_t *inode_ctx = NULL;
  226     glfs_fd_t *glfd = NULL;
  227     inode_t *inode = NULL;
  228 
  229     GF_VALIDATE_OR_GOTO("snapview-server", this, out);
  230     GF_VALIDATE_OR_GOTO(this->name, fd, out);
  231 
  232     inode = fd->inode;
  233     svs_fd = __svs_fd_ctx_get(this, fd);
  234     if (svs_fd) {
  235         ret = 0;
  236         goto out;
  237     }
  238 
  239     svs_fd = svs_fd_new();
  240     if (!svs_fd) {
  241         gf_msg(this->name, GF_LOG_ERROR, 0, SVS_MSG_NEW_FD_CTX_FAILED,
  242                "failed to allocate new fd "
  243                "context for gfid %s",
  244                uuid_utoa(inode->gfid));
  245         goto out;
  246     }
  247 
  248     if (fd_is_anonymous(fd)) {
  249         inode_ctx = svs_inode_ctx_get(this, inode);
  250         if (!inode_ctx) {
  251             gf_msg(this->name, GF_LOG_ERROR, 0,
  252                    SVS_MSG_GET_INODE_CONTEXT_FAILED,
  253                    "failed to get inode "
  254                    "context for %s",
  255                    uuid_utoa(inode->gfid));
  256             goto out;
  257         }
  258 
  259         fs = inode_ctx->fs;
  260         object = inode_ctx->object;
  261 
  262         if (inode->ia_type == IA_IFDIR) {
  263             glfd = glfs_h_opendir(fs, object);
  264             if (!glfd) {
  265                 gf_msg(this->name, GF_LOG_ERROR, errno, SVS_MSG_OPENDIR_FAILED,
  266                        "failed to "
  267                        "open the directory %s",
  268                        uuid_utoa(inode->gfid));
  269                 goto out;
  270             }
  271         }
  272 
  273         if (inode->ia_type == IA_IFREG) {
  274             glfd = glfs_h_open(fs, object, O_RDONLY | O_LARGEFILE);
  275             if (!glfd) {
  276                 gf_msg(this->name, GF_LOG_ERROR, errno, SVS_MSG_OPEN_FAILED,
  277                        "failed to "
  278                        "open the file %s",
  279                        uuid_utoa(inode->gfid));
  280                 goto out;
  281             }
  282         }
  283 
  284         svs_fd->fd = glfd;
  285     }
  286 
  287     ret = __svs_fd_ctx_set(this, fd, svs_fd);
  288     if (ret) {
  289         gf_msg(this->name, GF_LOG_ERROR, 0, SVS_MSG_SET_FD_CONTEXT_FAILED,
  290                "failed to set fd context "
  291                "for gfid %s",
  292                uuid_utoa(inode->gfid));
  293         if (svs_fd->fd) {
  294             if (inode->ia_type == IA_IFDIR) {
  295                 ret = glfs_closedir(svs_fd->fd);
  296                 if (ret)
  297                     gf_msg(this->name, GF_LOG_ERROR, errno,
  298                            SVS_MSG_CLOSEDIR_FAILED,
  299                            "failed to close the fd for %s",
  300                            uuid_utoa(inode->gfid));
  301             }
  302             if (inode->ia_type == IA_IFREG) {
  303                 ret = glfs_close(svs_fd->fd);
  304                 if (ret)
  305                     gf_msg(this->name, GF_LOG_ERROR, 0, SVS_MSG_CLOSE_FAILED,
  306                            "failed to close the fd for %s",
  307                            uuid_utoa(inode->gfid));
  308             }
  309         }
  310         ret = -1;
  311     }
  312 
  313 out:
  314     if (ret) {
  315         GF_FREE(svs_fd);
  316         svs_fd = NULL;
  317     }
  318 
  319     return svs_fd;
  320 }
  321 
  322 svs_fd_t *
  323 svs_fd_ctx_get_or_new(xlator_t *this, fd_t *fd)
  324 {
  325     svs_fd_t *svs_fd = NULL;
  326 
  327     GF_VALIDATE_OR_GOTO("snapview-server", this, out);
  328     GF_VALIDATE_OR_GOTO(this->name, fd, out);
  329 
  330     LOCK(&fd->lock);
  331     {
  332         svs_fd = __svs_fd_ctx_get_or_new(this, fd);
  333     }
  334     UNLOCK(&fd->lock);
  335 
  336 out:
  337     return svs_fd;
  338 }
  339 
  340 int
  341 svs_uuid_generate(xlator_t *this, uuid_t gfid, char *snapname,
  342                   uuid_t origin_gfid)
  343 {
  344     char ino_string[NAME_MAX + 32] = "";
  345     uuid_t tmp = {
  346         0,
  347     };
  348     int ret = -1;
  349 
  350     GF_VALIDATE_OR_GOTO("snapview-server", this, out);
  351     GF_VALIDATE_OR_GOTO(this->name, snapname, out);
  352 
  353     (void)snprintf(ino_string, sizeof(ino_string), "%s%s", snapname,
  354                    uuid_utoa(origin_gfid));
  355 
  356     if (gf_gfid_generate_from_xxh64(tmp, ino_string)) {
  357         gf_msg(this->name, GF_LOG_WARNING, 0, SVS_MSG_GFID_GEN_FAILED,
  358                "failed to generate "
  359                "gfid for object with actual gfid of %s "
  360                "(snapname: %s, key: %s)",
  361                uuid_utoa(origin_gfid), snapname, ino_string);
  362         goto out;
  363     }
  364 
  365     gf_uuid_copy(gfid, tmp);
  366 
  367     ret = 0;
  368 
  369     gf_msg_debug(this->name, 0, "gfid generated is %s ", uuid_utoa(gfid));
  370 
  371 out:
  372     return ret;
  373 }
  374 
  375 void
  376 svs_fill_ino_from_gfid(struct iatt *buf)
  377 {
  378     xlator_t *this = NULL;
  379 
  380     this = THIS;
  381 
  382     GF_VALIDATE_OR_GOTO("snapview-server", this, out);
  383     GF_VALIDATE_OR_GOTO(this->name, buf, out);
  384 
  385     /* consider least significant 8 bytes of value out of gfid */
  386     if (gf_uuid_is_null(buf->ia_gfid)) {
  387         buf->ia_ino = -1;
  388         goto out;
  389     }
  390 
  391     buf->ia_ino = gfid_to_ino(buf->ia_gfid);
  392 out:
  393     return;
  394 }
  395 
  396 void
  397 svs_iatt_fill(uuid_t gfid, struct iatt *buf)
  398 {
  399     struct timeval tv = {
  400         0,
  401     };
  402     xlator_t *this = NULL;
  403 
  404     this = THIS;
  405 
  406     GF_VALIDATE_OR_GOTO("snapview-server", this, out);
  407     GF_VALIDATE_OR_GOTO(this->name, buf, out);
  408 
  409     buf->ia_type = IA_IFDIR;
  410     buf->ia_uid = 0;
  411     buf->ia_gid = 0;
  412     buf->ia_size = 0;
  413     buf->ia_nlink = 2;
  414     buf->ia_blocks = 8;
  415     buf->ia_size = 4096;
  416 
  417     gf_uuid_copy(buf->ia_gfid, gfid);
  418     svs_fill_ino_from_gfid(buf);
  419 
  420     buf->ia_prot = ia_prot_from_st_mode(0755);
  421 
  422     gettimeofday(&tv, 0);
  423 
  424     buf->ia_mtime = buf->ia_atime = buf->ia_ctime = tv.tv_sec;
  425     buf->ia_mtime_nsec = buf->ia_atime_nsec = buf->ia_ctime_nsec = (tv.tv_usec *
  426                                                                     1000);
  427 
  428 out:
  429     return;
  430 }
  431 
  432 /* priv->snaplist_lock should be held before calling this function */
  433 snap_dirent_t *
  434 __svs_get_snap_dirent(xlator_t *this, const char *name)
  435 {
  436     svs_private_t *private = NULL;
  437     int i = 0;
  438     snap_dirent_t *dirents = NULL;
  439     snap_dirent_t *tmp_dirent = NULL;
  440     snap_dirent_t *dirent = NULL;
  441 
  442    private
  443     = this->private;
  444 
  445     dirents = private->dirents;
  446     if (!dirents) {
  447         goto out;
  448     }
  449 
  450     tmp_dirent = dirents;
  451     for (i = 0; i < private->num_snaps; i++) {
  452         if (!strcmp(tmp_dirent->name, name)) {
  453             dirent = tmp_dirent;
  454             break;
  455         }
  456         tmp_dirent++;
  457     }
  458 
  459 out:
  460     return dirent;
  461 }
  462 
  463 glfs_t *
  464 __svs_initialise_snapshot_volume(xlator_t *this, const char *name,
  465                                  int32_t *op_errno)
  466 {
  467     svs_private_t *priv = NULL;
  468     int32_t ret = -1;
  469     int32_t local_errno = ESTALE;
  470     snap_dirent_t *dirent = NULL;
  471     char volname[PATH_MAX] = {
  472         0,
  473     };
  474     glfs_t *fs = NULL;
  475     int loglevel = GF_LOG_INFO;
  476     char logfile[PATH_MAX] = {
  477         0,
  478     };
  479     char *volfile_server = NULL;
  480 
  481     GF_VALIDATE_OR_GOTO("snapview-server", this, out);
  482     GF_VALIDATE_OR_GOTO(this->name, this->private, out);
  483     GF_VALIDATE_OR_GOTO(this->name, name, out);
  484 
  485     priv = this->private;
  486 
  487     dirent = __svs_get_snap_dirent(this, name);
  488     if (!dirent) {
  489         gf_msg_debug(this->name, 0,
  490                      "snap entry for "
  491                      "name %s not found",
  492                      name);
  493         local_errno = ENOENT;
  494         goto out;
  495     }
  496 
  497     if (dirent->fs) {
  498         ret = 0;
  499         fs = dirent->fs;
  500         goto out;
  501     }
  502 
  503     snprintf(volname, sizeof(volname), "/snaps/%s/%s/%s", dirent->name,
  504              dirent->snap_volname, dirent->snap_volname);
  505 
  506     fs = glfs_new(volname);
  507     if (!fs) {
  508         local_errno = ENOMEM;
  509         gf_msg(this->name, GF_LOG_ERROR, local_errno, SVS_MSG_GLFS_NEW_FAILED,
  510                "glfs instance for snap volume %s "
  511                "failed",
  512                dirent->name);
  513         goto out;
  514     }
  515 
  516     /*
  517      * Before, localhost was used as the volfile server. But, with that
  518      * method, accessing snapshots started giving ENOENT error if a
  519      * specific bind address is mentioned in the glusterd volume file.
  520      * Check the bug https://bugzilla.redhat.com/show_bug.cgi?id=1725211.
  521      * So, the new method is tried below, where, snapview-server first
  522      * uses the volfile server used by the snapd (obtained from the
  523      * command line arguments saved in the global context of the process).
  524      * If the volfile server in global context is NULL, then localhost
  525      * is tried (like before).
  526      */
  527     if (this->ctx->cmd_args.volfile_server) {
  528         volfile_server = gf_strdup(this->ctx->cmd_args.volfile_server);
  529         if (!volfile_server) {
  530             gf_msg(this->name, GF_LOG_WARNING, ENOMEM,
  531                    SVS_MSG_VOLFILE_SERVER_GET_FAIL,
  532                    "failed to copy volfile server %s. ",
  533                    this->ctx->cmd_args.volfile_server);
  534             ret = -1;
  535             goto out;
  536         }
  537     } else {
  538         gf_msg(this->name, GF_LOG_WARNING, ENOMEM,
  539                SVS_MSG_VOLFILE_SERVER_GET_FAIL,
  540                "volfile server is NULL in cmd args. "
  541                "Trying with localhost");
  542         volfile_server = gf_strdup("localhost");
  543         if (!volfile_server) {
  544             gf_msg(this->name, GF_LOG_WARNING, ENOMEM,
  545                    SVS_MSG_VOLFILE_SERVER_GET_FAIL,
  546                    "failed to copy volfile server localhost.");
  547             ret = -1;
  548             goto out;
  549         }
  550     }
  551 
  552     ret = glfs_set_volfile_server(fs, "tcp", volfile_server, 24007);
  553     if (ret) {
  554         gf_msg(this->name, GF_LOG_ERROR, local_errno,
  555                SVS_MSG_SET_VOLFILE_SERVR_FAILED,
  556                "setting the "
  557                "volfile server %s for snap volume %s "
  558                "failed",
  559                volfile_server, dirent->name);
  560         goto out;
  561     }
  562 
  563     snprintf(logfile, sizeof(logfile),
  564              DEFAULT_SVD_LOG_FILE_DIRECTORY "/snaps/%s/%s-%s.log",
  565              priv->volname, name, dirent->uuid);
  566 
  567     ret = glfs_set_logging(fs, logfile, loglevel);
  568     if (ret) {
  569         gf_msg(this->name, GF_LOG_ERROR, local_errno,
  570                SVS_MSG_SET_LOGGING_FAILED,
  571                "failed to set the "
  572                "log file path");
  573         goto out;
  574     }
  575 
  576     ret = glfs_init(fs);
  577     if (ret) {
  578         gf_msg(this->name, GF_LOG_ERROR, local_errno, SVS_MSG_GLFS_INIT_FAILED,
  579                "initing the "
  580                "fs for %s failed",
  581                dirent->name);
  582         goto out;
  583     }
  584 
  585     ret = 0;
  586 
  587 out:
  588     if (ret) {
  589         if (op_errno)
  590             *op_errno = local_errno;
  591 
  592         if (fs)
  593             glfs_fini(fs);
  594         fs = NULL;
  595     }
  596 
  597     if (fs) {
  598         dirent->fs = fs;
  599     }
  600 
  601     GF_FREE(volfile_server);
  602     return fs;
  603 }
  604 
  605 glfs_t *
  606 svs_initialise_snapshot_volume(xlator_t *this, const char *name,
  607                                int32_t *op_errno)
  608 {
  609     glfs_t *fs = NULL;
  610     svs_private_t *priv = NULL;
  611 
  612     GF_VALIDATE_OR_GOTO("snapview-server", this, out);
  613     GF_VALIDATE_OR_GOTO(this->name, this->private, out);
  614     GF_VALIDATE_OR_GOTO(this->name, name, out);
  615 
  616     priv = this->private;
  617 
  618     LOCK(&priv->snaplist_lock);
  619     {
  620         fs = __svs_initialise_snapshot_volume(this, name, op_errno);
  621     }
  622     UNLOCK(&priv->snaplist_lock);
  623 
  624 out:
  625 
  626     return fs;
  627 }
  628 
  629 snap_dirent_t *
  630 svs_get_latest_snap_entry(xlator_t *this)
  631 {
  632     svs_private_t *priv = NULL;
  633     snap_dirent_t *dirents = NULL;
  634     snap_dirent_t *dirent = NULL;
  635 
  636     GF_VALIDATE_OR_GOTO("svs", this, out);
  637 
  638     priv = this->private;
  639 
  640     LOCK(&priv->snaplist_lock);
  641     {
  642         dirents = priv->dirents;
  643         if (!dirents) {
  644             goto unlock;
  645         }
  646         if (priv->num_snaps)
  647             dirent = &dirents[priv->num_snaps - 1];
  648     }
  649 unlock:
  650     UNLOCK(&priv->snaplist_lock);
  651 
  652 out:
  653     return dirent;
  654 }
  655 
  656 glfs_t *
  657 svs_get_latest_snapshot(xlator_t *this)
  658 {
  659     glfs_t *fs = NULL;
  660     snap_dirent_t *dirent = NULL;
  661     svs_private_t *priv = NULL;
  662 
  663     GF_VALIDATE_OR_GOTO("svs", this, out);
  664     priv = this->private;
  665 
  666     dirent = svs_get_latest_snap_entry(this);
  667 
  668     if (dirent) {
  669         LOCK(&priv->snaplist_lock);
  670         {
  671             fs = dirent->fs;
  672         }
  673         UNLOCK(&priv->snaplist_lock);
  674     }
  675 
  676 out:
  677     return fs;
  678 }
  679 
  680 glfs_t *
  681 svs_inode_ctx_glfs_mapping(xlator_t *this, svs_inode_t *inode_ctx)
  682 {
  683     glfs_t *fs = NULL;
  684 
  685     GF_VALIDATE_OR_GOTO("svs", this, out);
  686     GF_VALIDATE_OR_GOTO(this->name, inode_ctx, out);
  687 
  688     fs = inode_ctx->fs;
  689 
  690     SVS_CHECK_VALID_SNAPSHOT_HANDLE(fs, this);
  691 
  692 out:
  693     return fs;
  694 }
  695 
  696 glfs_t *
  697 svs_inode_glfs_mapping(xlator_t *this, inode_t *inode)
  698 {
  699     svs_inode_t *inode_ctx = NULL;
  700     glfs_t *fs = NULL;
  701 
  702     inode_ctx = svs_inode_ctx_get(this, inode);
  703     if (!inode_ctx) {
  704         gf_msg(this->name, GF_LOG_ERROR, 0, SVS_MSG_GET_INODE_CONTEXT_FAILED,
  705                "inode context not found for"
  706                " the inode %s",
  707                uuid_utoa(inode->gfid));
  708         goto out;
  709     }
  710 
  711     fs = svs_inode_ctx_glfs_mapping(this, inode_ctx);
  712 
  713 out:
  714     return fs;
  715 }