diff options
| author | Vijay Bellur <vijay@gluster.com> | 2012-05-07 01:06:36 -0700 | 
|---|---|---|
| committer | Vijay Bellur <vijay@gluster.com> | 2012-05-07 01:06:36 -0700 | 
| commit | 9189ff9739e0daad3f528da4039155f32ba211ce (patch) | |
| tree | e7fc62eb15a512f59d609e2d9e67356e1ab4640f /contrib/fuse-lib/mount.c | |
| parent | c4dadc74fd1d1188f123eae7f2b6d6f5232e2a0f (diff) | |
Revert "fuse: allow requests during mount (needed for SELinux labels)"v3.3.0qa40
This reverts commit 7d0397c2144810c8a396e00187a6617873c94002.
Diffstat (limited to 'contrib/fuse-lib/mount.c')
| -rw-r--r-- | contrib/fuse-lib/mount.c | 60 | 
1 files changed, 10 insertions, 50 deletions
diff --git a/contrib/fuse-lib/mount.c b/contrib/fuse-lib/mount.c index 8c5da3d619f..800fd193e6c 100644 --- a/contrib/fuse-lib/mount.c +++ b/contrib/fuse-lib/mount.c @@ -544,25 +544,19 @@ gf_fuse_unmount (const char *mountpoint, int fd)  #ifndef FUSE_UTIL  static int -fuse_mount_sys (const char *mountpoint, char *fsname, char *mnt_param, pid_t *mtab_pid, int in_fd, int status_fd) +fuse_mount_sys (const char *mountpoint, char *fsname, char *mnt_param, pid_t *mtab_pid)  {          int fd = -1, ret = -1;          unsigned mounted = 0;          char *mnt_param_mnt = NULL;          char *fstype = "fuse.glusterfs";          char *source = fsname; -        pid_t mypid = -1; -        if (in_fd >= 0) { -                fd = in_fd; -        } -        else { -                fd = open ("/dev/fuse", O_RDWR); -                if (fd == -1) { -                        GFFUSE_LOGERR ("cannot open /dev/fuse (%s)", -                                        strerror (errno)); -                        return -1; -                } +        fd = open ("/dev/fuse", O_RDWR); +        if (fd == -1) { +                GFFUSE_LOGERR ("cannot open /dev/fuse (%s)", strerror (errno)); + +                return -1;          }          ret = asprintf (&mnt_param_mnt, @@ -573,14 +567,8 @@ fuse_mount_sys (const char *mountpoint, char *fsname, char *mnt_param, pid_t *mt                  goto out;          } -        ret = fork(); -        if (ret != 0) { -                goto parent_out; -        } -        GFFUSE_LOGERR("calling mount");          ret = mount (source, mountpoint, fstype, 0,                       mnt_param_mnt); -        GFFUSE_LOGERR("mount returned %d",ret);          if (ret == -1 && errno == ENODEV) {                  /* fs subtype support was added by 79c0b2df aka                     v2.6.21-3159-g79c0b2d. Probably we have an @@ -619,31 +607,11 @@ fuse_mount_sys (const char *mountpoint, char *fsname, char *mnt_param, pid_t *mt                  }          } -        ret = 0; -out: -        if (status_fd >= 0) { -                GFFUSE_LOGERR("writing status"); -                (void)write(status_fd,&ret,sizeof(ret)); -                mypid = getpid(); -                /* -                 * This seems awkward, but the alternative would be to add -                 * or change return values for functions in multiple layers, -                 * just so they can store the value for later retrieval by -                 * the code already running in the right context at the other -                 * end of this pipe.  That's a lot of disruption for nothing. -                 */ -                (void)write(status_fd,&mypid,sizeof(mypid)); -        } -        GFFUSE_LOGERR("Mount child exiting"); -        exit(0); - -parent_out: + out:          if (ret == -1) {                  if (mounted)                          umount2 (mountpoint, 2); /* lazy umount */ -                if (fd != in_fd) { -                        close (fd); -                } +                close (fd);                  fd = -1;          }          FREE (mnt_param_mnt); @@ -683,21 +651,13 @@ escape (char *s)  int  gf_fuse_mount (const char *mountpoint, char *fsname, char *mnt_param, -               pid_t *mtab_pid, int status_fd) +               pid_t *mtab_pid)  {          int fd = -1, rv = -1;          char *fm_mnt_params = NULL, *p = NULL;          char *efsname = NULL; -        fd = open ("/dev/fuse", O_RDWR); -        if (fd == -1) { -                GFFUSE_LOGERR ("cannot open /dev/fuse (%s)", -                                strerror (errno)); -                return -1; -        } - -        fd = fuse_mount_sys (mountpoint, fsname, mnt_param, mtab_pid, fd, -                             status_fd); +        fd = fuse_mount_sys (mountpoint, fsname, mnt_param, mtab_pid);          if (fd == -1) {                  gf_log ("glusterfs-fuse", GF_LOG_INFO,                          "direct mount failed (%s), "  | 
