Whamcloud - gitweb
e41a1c2ff110c67b72c2dabcb553fb72aa829b87
[fs/lustre-release.git] / lustre / utils / mount_lustre.c
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  * GPL HEADER START
5  *
6  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 only,
10  * as published by the Free Software Foundation.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License version 2 for more details (a copy is included
16  * in the LICENSE file that accompanied this code).
17  *
18  * You should have received a copy of the GNU General Public License
19  * version 2 along with this program; If not, see
20  * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
21  *
22  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
23  * CA 95054 USA or visit www.sun.com if you need additional information or
24  * have any questions.
25  *
26  * GPL HEADER END
27  */
28 /*
29  * Copyright  2008 Sun Microsystems, Inc. All rights reserved
30  * Use is subject to license terms.
31  */
32 /*
33  * This file is part of Lustre, http://www.lustre.org/
34  * Lustre is a trademark of Sun Microsystems, Inc.
35  *
36  * lustre/utils/mount_lustre.c
37  *
38  * Author: Robert Read <rread@clusterfs.com>
39  * Author: Nathan Rutman <nathan@clusterfs.com>
40  */
41
42 #ifndef _GNU_SOURCE
43 #define _GNU_SOURCE
44 #endif
45 #include <stdlib.h>
46 #include <stdio.h>
47 #include <unistd.h>
48 #include <fcntl.h>
49 #include <errno.h>
50 #include <string.h>
51 #include <sys/mount.h>
52 #include <mntent.h>
53 #include <getopt.h>
54 #include "obdctl.h"
55 #include <lustre_ver.h>
56 #include <glob.h>
57 #include <ctype.h>
58 #include <limits.h>
59 #include "mount_utils.h"
60
61 #define MAX_HW_SECTORS_KB_PATH  "queue/max_hw_sectors_kb"
62 #define MAX_SECTORS_KB_PATH     "queue/max_sectors_kb"
63 #define MAX_RETRIES 99
64
65 int          verbose = 0;
66 int          nomtab = 0;
67 int          fake = 0;
68 int          force = 0;
69 int          retry = 0;
70 char         *progname = NULL;
71
72 void usage(FILE *out)
73 {
74         fprintf(out, "%s v"LUSTRE_VERSION_STRING"\n", progname);
75         fprintf(out, "\nThis mount helper should only be invoked via the "
76                 "mount (8) command,\ne.g. mount -t lustre dev dir\n\n");
77         fprintf(out, "usage: %s [-fhnv] [-o <mntopt>] <device> <mountpt>\n",
78                 progname);
79         fprintf(out,
80                 "\t<device>: the disk device, or for a client:\n"
81                 "\t\t<mgmtnid>[:<altmgtnid>...]:/<filesystem>-client\n"
82                 "\t<filesystem>: name of the Lustre filesystem (e.g. lustre1)\n"
83                 "\t<mountpt>: filesystem mountpoint (e.g. /mnt/lustre)\n"
84                 "\t-f|--fake: fake mount (updates /etc/mtab)\n"
85                 "\t--force: force mount even if already in /etc/mtab\n"
86                 "\t-h|--help: print this usage message\n"
87                 "\t-n|--nomtab: do not update /etc/mtab after mount\n"
88                 "\t-v|--verbose: print verbose config settings\n"
89                 "\t<mntopt>: one or more comma separated of:\n"
90                 "\t\t(no)flock,(no)user_xattr,(no)acl\n"
91                 "\t\tnosvc: only start MGC/MGS obds\n"
92                 "\t\tnomgs: only start target obds, using existing MGS\n"
93                 "\t\texclude=<ostname>[:<ostname>] : colon-separated list of "
94                 "inactive OSTs (e.g. lustre-OST0001)\n"
95                 "\t\tretry=<num>: number of times mount is retried by client\n"
96                 );
97         exit((out != stdout) ? EINVAL : 0);
98 }
99
100 static int check_mtab_entry(char *spec, char *mtpt, char *type)
101 {
102         FILE *fp;
103         struct mntent *mnt;
104
105         fp = setmntent(MOUNTED, "r");
106         if (fp == NULL)
107                 return(0);
108
109         while ((mnt = getmntent(fp)) != NULL) {
110                 if (strcmp(mnt->mnt_fsname, spec) == 0 &&
111                         strcmp(mnt->mnt_dir, mtpt) == 0 &&
112                         strcmp(mnt->mnt_type, type) == 0) {
113                         endmntent(fp);
114                         return(EEXIST);
115                 }
116         }
117         endmntent(fp);
118
119         return(0);
120 }
121
122 static int
123 update_mtab_entry(char *spec, char *mtpt, char *type, char *opts,
124                   int flags, int freq, int pass)
125 {
126         FILE *fp;
127         struct mntent mnt;
128         int rc = 0;
129
130         mnt.mnt_fsname = spec;
131         mnt.mnt_dir = mtpt;
132         mnt.mnt_type = type;
133         mnt.mnt_opts = opts ? opts : "";
134         mnt.mnt_freq = freq;
135         mnt.mnt_passno = pass;
136
137         fp = setmntent(MOUNTED, "a+");
138         if (fp == NULL) {
139                 fprintf(stderr, "%s: setmntent(%s): %s:",
140                         progname, MOUNTED, strerror (errno));
141                 rc = 16;
142         } else {
143                 if ((addmntent(fp, &mnt)) == 1) {
144                         fprintf(stderr, "%s: addmntent: %s:",
145                                 progname, strerror (errno));
146                         rc = 16;
147                 }
148                 endmntent(fp);
149         }
150
151         return rc;
152 }
153
154 /* Get rid of symbolic hostnames for tcp, since kernel can't do lookups */
155 #define MAXNIDSTR 1024
156 static char *convert_hostnames(char *s1)
157 {
158         char *converted, *s2 = 0, *c;
159         char sep;
160         int left = MAXNIDSTR;
161         lnet_nid_t nid;
162
163         converted = malloc(left);
164         c = converted;
165         while ((left > 0) && (*s1 != '/')) {
166                 s2 = strpbrk(s1, ",:");
167                 if (!s2)
168                         goto out_free;
169                 sep = *s2;
170                 *s2 = '\0';
171                 nid = libcfs_str2nid(s1);
172                 *s2 = sep;                      /* back to original string */
173                 if (nid == LNET_NID_ANY)
174                         goto out_free;
175                 c += snprintf(c, left, "%s%c", libcfs_nid2str(nid), sep);
176                 left = converted + MAXNIDSTR - c;
177                 s1 = s2 + 1;
178         }
179         snprintf(c, left, "%s", s1);
180         return converted;
181 out_free:
182         fprintf(stderr, "%s: Can't parse NID '%s'\n", progname, s1);
183         free(converted);
184         return NULL;
185 }
186
187 /*****************************************************************************
188  *
189  * This part was cribbed from util-linux/mount/mount.c.  There was no clear
190  * license information, but many other files in the package are identified as
191  * GNU GPL, so it's a pretty safe bet that was their intent.
192  *
193  ****************************************************************************/
194 struct opt_map {
195         const char *opt;        /* option name */
196         int inv;                /* true if flag value should be inverted */
197         int mask;               /* flag mask value */
198 };
199
200 static const struct opt_map opt_map[] = {
201   /*"optname", inv,ms_mask */
202   /* These flags are parsed by mount, not lustre */
203   { "defaults", 0, 0         },      /* default options */
204   { "remount",  0, MS_REMOUNT},      /* remount with different options */
205   { "rw",       1, MS_RDONLY },      /* read-write */
206   { "ro",       0, MS_RDONLY },      /* read-only */
207   { "exec",     1, MS_NOEXEC },      /* permit execution of binaries */
208   { "noexec",   0, MS_NOEXEC },      /* don't execute binaries */
209   { "suid",     1, MS_NOSUID },      /* honor suid executables */
210   { "nosuid",   0, MS_NOSUID },      /* don't honor suid executables */
211   { "dev",      1, MS_NODEV  },      /* interpret device files  */
212   { "nodev",    0, MS_NODEV  },      /* don't interpret devices */
213   { "sync",     0, MS_SYNCHRONOUS},  /* synchronous I/O */
214   { "async",    1, MS_SYNCHRONOUS},  /* asynchronous I/O */
215   { "atime",    1, MS_NOATIME  },    /* set file access time on read */
216   { "noatime",  0, MS_NOATIME  },    /* do not set file access time on read */
217 #ifdef MS_NODIRATIME
218   { "diratime", 1, MS_NODIRATIME },  /* set file access time on read */
219   { "nodiratime",0,MS_NODIRATIME },  /* do not set file access time on read */
220 #endif
221 #ifdef MS_RELATIME
222   { "relatime", 0, MS_RELATIME },  /* set file access time on read */
223   { "norelatime",1,MS_RELATIME },  /* do not set file access time on read */
224 #endif
225   { "auto",     0, 0         },      /* Can be mounted using -a */
226   { "noauto",   0, 0         },      /* Can only be mounted explicitly */
227   { "nousers",  1, 0         },      /* Forbid ordinary user to mount */
228   { "nouser",   1, 0         },      /* Forbid ordinary user to mount */
229   { "noowner",  1, 0         },      /* Device owner has no special privs */
230   { "_netdev",  0, 0         },      /* Device accessible only via network */
231   { "loop",     0, 0         },
232   { NULL,       0, 0         }
233 };
234 /****************************************************************************/
235
236 /* 1  = don't pass on to lustre
237    0  = pass on to lustre */
238 static int parse_one_option(const char *check, int *flagp)
239 {
240         const struct opt_map *opt;
241
242         for (opt = &opt_map[0]; opt->opt != NULL; opt++) {
243                 if (strncmp(check, opt->opt, strlen(opt->opt)) == 0) {
244                         if (opt->mask) {
245                                 if (opt->inv)
246                                         *flagp &= ~(opt->mask);
247                                 else
248                                         *flagp |= opt->mask;
249                         }
250                         return 1;
251                 }
252         }
253         /* Assume any unknown options are valid and pass them on.  The mount
254            will fail if lmd_parse, ll_options or ldiskfs doesn't recognize it.*/
255         return 0;
256 }
257
258 /* Replace options with subset of Lustre-specific options, and
259    fill in mount flags */
260 int parse_options(char *orig_options, int *flagp)
261 {
262         char *options, *opt, *nextopt, *arg, *val;
263
264         options = calloc(strlen(orig_options) + 1, 1);
265         *flagp = 0;
266         nextopt = orig_options;
267         while ((opt = strsep(&nextopt, ","))) {
268                 if (!*opt)
269                         /* empty option */
270                         continue;
271
272                 /* Handle retries in a slightly different
273                  * manner */
274                 arg = opt;
275                 val = strchr(opt, '=');
276                 if (val != NULL && strncmp(arg, "retry", 5) == 0) {
277                         retry = atoi(val + 1);
278                         if (retry > MAX_RETRIES)
279                                 retry = MAX_RETRIES;
280                         else if (retry < 0)
281                                 retry = 0;
282                 }
283                 else if (parse_one_option(opt, flagp) == 0) {
284                         /* pass this on as an option */
285                         if (*options)
286                                 strcat(options, ",");
287                         strcat(options, opt);
288                 }
289         }
290         strcpy(orig_options, options);
291         free(options);
292         return 0;
293 }
294
295
296 int read_file(char *path, char *buf, int size)
297 {
298         FILE *fd;
299
300         fd = fopen(path, "r");
301         if (fd == NULL)
302                 return errno;
303
304         fgets(buf, size, fd);
305         fclose(fd);
306         return 0;
307 }
308
309 int write_file(char *path, char *buf)
310 {
311         FILE *fd;
312
313         fd = fopen(path, "w");
314         if (fd == NULL)
315                 return errno;
316
317         fputs(buf, fd);
318         fclose(fd);
319         return 0;
320 }
321
322 /* This is to tune the kernel for good SCSI performance.
323  * For that we set the value of /sys/block/{dev}/queue/max_sectors_kb
324  * to the value of /sys/block/{dev}/queue/max_hw_sectors_kb */
325 int set_tunables(char *source, int src_len)
326 {
327         glob_t glob_info;
328         struct stat stat_buf;
329         char *chk_major, *chk_minor;
330         char *savept, *dev, *s2 = 0;
331         char *ret_path;
332         char buf[PATH_MAX] = {'\0'}, path[PATH_MAX] = {'\0'};
333         char real_path[PATH_MAX] = {'\0'};
334         int i, rc = 0;
335         int major, minor;
336
337         if (!source)
338                 return -EINVAL;
339
340         ret_path = realpath(source, real_path);
341         if (ret_path == NULL) {
342                 if (verbose)
343                         fprintf(stderr, "warning: %s: cannot resolve: %s\n",
344                                 source, strerror(errno));
345                 return -EINVAL;
346         }
347
348         src_len = sizeof(real_path);
349
350         if (strncmp(real_path, "/dev/loop", 9) == 0)
351                 return 0;
352
353         if ((real_path[0] != '/') && ((s2 = strpbrk(real_path, ",:")) != NULL))
354                 return 0;
355
356         dev = real_path + src_len - 1;
357         while (dev > real_path && (*dev != '/')) {
358                 if (isdigit(*dev))
359                         *dev = 0;
360                 dev--;
361         }
362         snprintf(path, sizeof(path), "/sys/block%s/%s", dev,
363                  MAX_HW_SECTORS_KB_PATH);
364         rc = read_file(path, buf, sizeof(buf));
365         if (rc == 0 && (strlen(buf) - 1) > 0) {
366                 snprintf(path, sizeof(path), "/sys/block%s/%s", dev,
367                          MAX_SECTORS_KB_PATH);
368                 rc = write_file(path, buf);
369                 if (rc && verbose)
370                         fprintf(stderr, "warning: opening %s: %s\n",
371                                 path, strerror(errno));
372                 return rc;
373         }
374
375         if (rc != ENOENT)
376                 return rc;
377
378         /* The name of the device say 'X' specified in /dev/X may not
379          * match any entry under /sys/block/. In that case we need to
380          * match the major/minor number to find the entry under
381          * sys/block corresponding to /dev/X */
382         dev = real_path + src_len - 1;
383         while (dev > real_path) {
384                 if (isdigit(*dev))
385                         *dev = 0;
386                 dev--;
387         }
388
389         rc = stat(dev, &stat_buf);
390         if (rc) {
391                 if (verbose)
392                         fprintf(stderr, "warning: %s, device %s stat failed\n",
393                                 strerror(errno), dev);
394                 return rc;
395         }
396
397         major = major(stat_buf.st_rdev);
398         minor = minor(stat_buf.st_rdev);
399         rc = glob("/sys/block/*", GLOB_NOSORT, NULL, &glob_info);
400         if (rc) {
401                 if (verbose)
402                         fprintf(stderr, "warning: failed to read entries under "
403                                 "/sys/block\n");
404                 return rc;
405         }
406
407         for (i = 0; i < glob_info.gl_pathc; i++){
408                 snprintf(path, sizeof(path), "%s/dev", glob_info.gl_pathv[i]);
409
410                 rc = read_file(path, buf, sizeof(buf));
411                 if (rc)
412                         continue;
413
414                 if (buf[strlen(buf) - 1] == '\n')
415                         buf[strlen(buf) - 1] = '\0';
416
417                 chk_major = strtok_r(buf, ":", &savept);
418                 chk_minor = savept;
419                 if (major == atoi(chk_major) &&minor == atoi(chk_minor))
420                         break;
421         }
422
423         if (i == glob_info.gl_pathc) {
424                 if (verbose)
425                         fprintf(stderr,"warning: device %s does not match any "
426                                 "entry under /sys/block\n", real_path);
427                 rc = -EINVAL;
428                 goto out;
429         }
430
431         snprintf(path, sizeof(path), "%s/%s", glob_info.gl_pathv[i],
432                  MAX_HW_SECTORS_KB_PATH);
433         rc = read_file(path, buf, sizeof(buf));
434         if (rc) {
435                 if (verbose)
436                         fprintf(stderr, "warning: opening %s: %s\n",
437                                 path, strerror(errno));
438                 goto out;
439         }
440
441         if (strlen(buf) - 1 > 0) {
442                 snprintf(path, sizeof(path), "%s/%s",
443                          glob_info.gl_pathv[i], MAX_SECTORS_KB_PATH);
444                 rc = write_file(path, buf);
445                 if (rc && verbose)
446                         fprintf(stderr, "warning: writing to %s: %s\n",
447                                 path, strerror(errno));
448         }
449
450 out:
451         globfree(&glob_info);
452         return rc;
453 }
454
455 int main(int argc, char *const argv[])
456 {
457         char default_options[] = "";
458         char *usource, *source, *target, *ptr;
459         char *options, *optcopy, *orig_options = default_options;
460         int i, nargs = 3, opt, rc, flags, optlen;
461         static struct option long_opt[] = {
462                 {"fake", 0, 0, 'f'},
463                 {"force", 0, 0, 1},
464                 {"help", 0, 0, 'h'},
465                 {"nomtab", 0, 0, 'n'},
466                 {"options", 1, 0, 'o'},
467                 {"verbose", 0, 0, 'v'},
468                 {0, 0, 0, 0}
469         };
470
471         progname = strrchr(argv[0], '/');
472         progname = progname ? progname + 1 : argv[0];
473
474         while ((opt = getopt_long(argc, argv, "fhno:v",
475                                   long_opt, NULL)) != EOF){
476                 switch (opt) {
477                 case 1:
478                         ++force;
479                         printf("force: %d\n", force);
480                         nargs++;
481                         break;
482                 case 'f':
483                         ++fake;
484                         printf("fake: %d\n", fake);
485                         nargs++;
486                         break;
487                 case 'h':
488                         usage(stdout);
489                         break;
490                 case 'n':
491                         ++nomtab;
492                         printf("nomtab: %d\n", nomtab);
493                         nargs++;
494                         break;
495                 case 'o':
496                         orig_options = optarg;
497                         nargs++;
498                         break;
499                 case 'v':
500                         ++verbose;
501                         nargs++;
502                         break;
503                 default:
504                         fprintf(stderr, "%s: unknown option '%c'\n",
505                                 progname, opt);
506                         usage(stderr);
507                         break;
508                 }
509         }
510
511         if (optind + 2 > argc) {
512                 fprintf(stderr, "%s: too few arguments\n", progname);
513                 usage(stderr);
514         }
515
516         usource = argv[optind];
517         source = convert_hostnames(usource);
518         target = argv[optind + 1];
519         ptr = target + strlen(target) - 1;
520         while ((ptr > target) && (*ptr == '/')) {
521                 *ptr = 0;
522                 ptr--;
523         }
524
525         if (!usource || !source) {
526                 usage(stderr);
527         }
528
529         if (verbose) {
530                 for (i = 0; i < argc; i++)
531                         printf("arg[%d] = %s\n", i, argv[i]);
532                 printf("source = %s (%s), target = %s\n", usource, source,
533                        target);
534                 printf("options = %s\n", orig_options);
535         }
536
537         options = malloc(strlen(orig_options) + 1);
538         strcpy(options, orig_options);
539         rc = parse_options(options, &flags);
540         if (rc) {
541                 fprintf(stderr, "%s: can't parse options: %s\n",
542                         progname, options);
543                 return(EINVAL);
544         }
545
546         if (!force) {
547                 rc = check_mtab_entry(usource, target, "lustre");
548                 if (rc && !(flags & MS_REMOUNT)) {
549                         fprintf(stderr, "%s: according to %s %s is "
550                                 "already mounted on %s\n",
551                                 progname, MOUNTED, usource, target);
552                         return(EEXIST);
553                 }
554                 if (!rc && (flags & MS_REMOUNT)) {
555                         fprintf(stderr, "%s: according to %s %s is "
556                                 "not already mounted on %s\n",
557                                 progname, MOUNTED, usource, target);
558                         return(ENOENT);
559                 }
560         }
561         if (flags & MS_REMOUNT)
562                 nomtab++;
563
564         rc = access(target, F_OK);
565         if (rc) {
566                 rc = errno;
567                 fprintf(stderr, "%s: %s inaccessible: %s\n", progname, target,
568                         strerror(errno));
569                 return rc;
570         }
571
572         /* In Linux 2.4, the target device doesn't get passed to any of our
573            functions.  So we'll stick it on the end of the options. */
574         optlen = strlen(options) + strlen(",device=") + strlen(source) + 1;
575         optcopy = malloc(optlen);
576         strcpy(optcopy, options);
577         if (*optcopy)
578                 strcat(optcopy, ",");
579         strcat(optcopy, "device=");
580         strcat(optcopy, source);
581
582         if (verbose)
583                 printf("mounting device %s at %s, flags=%#x options=%s\n",
584                        source, target, flags, optcopy);
585
586         if (set_tunables(source, strlen(source)) && verbose)
587                 fprintf(stderr, "%s: unable to set tunables for %s"
588                                 " (may cause reduced IO performance)\n",
589                                 argv[0], source);
590
591         register_service_tags(usource, source, target);
592
593         if (!fake) {
594                 /* flags and target get to lustre_get_sb, but not
595                    lustre_fill_super.  Lustre ignores the flags, but mount
596                    does not. */
597                 for (i = 0, rc = -EAGAIN; i <= retry && rc != 0; i++) {
598                         rc = mount(source, target, "lustre", flags,
599                                    (void *)optcopy);
600                         if (rc) {
601                                 if (verbose) {
602                                         fprintf(stderr, "%s: mount %s at %s "
603                                                 "failed: %s retries left: "
604                                                 "%d\n", basename(progname),
605                                                 usource, target,
606                                                 strerror(errno), retry-i);
607                                 }
608
609                                 if (retry) {
610                                         sleep(1 << max((i/2), 5));
611                                 }
612                                 else {
613                                         rc = errno;
614                                 }
615                         }
616                 }
617         }
618
619         if (rc) {
620                 char *cli;
621
622                 rc = errno;
623
624                 cli = strrchr(usource, ':');
625                 if (cli && (strlen(cli) > 2))
626                         cli += 2;
627                 else
628                         cli = NULL;
629
630                 fprintf(stderr, "%s: mount %s at %s failed: %s\n", progname,
631                         usource, target, strerror(errno));
632                 if (errno == ENODEV)
633                         fprintf(stderr, "Are the lustre modules loaded?\n"
634                                 "Check /etc/modprobe.conf and /proc/filesystems"
635                                 "\nNote 'alias lustre llite' should be removed"
636                                 " from modprobe.conf\n");
637                 if (errno == ENOTBLK)
638                         fprintf(stderr, "Do you need -o loop?\n");
639                 if (errno == ENOMEDIUM)
640                         fprintf(stderr,
641                                 "This filesystem needs at least 1 OST\n");
642                 if (errno == ENOENT) {
643                         fprintf(stderr, "Is the MGS specification correct?\n");
644                         fprintf(stderr, "Is the filesystem name correct?\n");
645                         fprintf(stderr, "If upgrading, is the copied client log"
646                                 " valid? (see upgrade docs)\n");
647                 }
648                 if (errno == EALREADY)
649                         fprintf(stderr, "The target service is already running."
650                                 " (%s)\n", usource);
651                 if (errno == ENXIO)
652                         fprintf(stderr, "The target service failed to start "
653                                 "(bad config log?) (%s).  "
654                                 "See /var/log/messages.\n", usource);
655                 if (errno == EIO)
656                         fprintf(stderr, "Is the MGS running?\n");
657                 if (errno == EADDRINUSE)
658                         fprintf(stderr, "The target service's index is already "
659                                 "in use. (%s)\n", usource);
660                 if (errno == EINVAL) {
661                         fprintf(stderr, "This may have multiple causes.\n");
662                         if (cli)
663                                 fprintf(stderr, "Is '%s' the correct filesystem"
664                                         " name?\n", cli);
665                         fprintf(stderr, "Are the mount options correct?\n");
666                         fprintf(stderr, "Check the syslog for more info.\n");
667                 }
668
669                 /* May as well try to clean up loop devs */
670                 if (strncmp(usource, "/dev/loop", 9) == 0) {
671                         char cmd[256];
672                         sprintf(cmd, "/sbin/losetup -d %s", usource);
673                         system(cmd);
674                 }
675
676         } else if (!nomtab) {
677                 rc = update_mtab_entry(usource, target, "lustre", orig_options,
678                                        0,0,0);
679         }
680
681         free(optcopy);
682         free(source);
683         return rc;
684 }