diff options
Diffstat (limited to 'xlators/mount/fuse/utils/mount.glusterfs.in')
| -rwxr-xr-x | xlators/mount/fuse/utils/mount.glusterfs.in | 195 |
1 files changed, 176 insertions, 19 deletions
diff --git a/xlators/mount/fuse/utils/mount.glusterfs.in b/xlators/mount/fuse/utils/mount.glusterfs.in index 78e32826b0b..ac4d94cb743 100755 --- a/xlators/mount/fuse/utils/mount.glusterfs.in +++ b/xlators/mount/fuse/utils/mount.glusterfs.in @@ -34,7 +34,7 @@ _init () # check whether getfattr exists export PATH - getfattr=$(which getfattr 2>/dev/null); + getfattr=$(command -v getfattr 2>/dev/null) if [ $? -ne 0 ]; then warn "WARNING: getfattr not found, certain checks will be skipped.." fi @@ -161,10 +161,6 @@ start_glusterfs () cmd_line=$(echo "$cmd_line --volfile-max-fetch-attempts=$volfile_max_fetch_attempts") fi - if [ -n "$fopen_keep_cache" ]; then - cmd_line=$(echo "$cmd_line --fopen-keep-cache"); - fi - if [ -n "$volfile_check" ]; then cmd_line=$(echo "$cmd_line --volfile-check"); fi @@ -185,7 +181,35 @@ start_glusterfs () cmd_line=$(echo "$cmd_line --no-root-squash"); fi -#options with values start here + if [ -n "$thin_client" ]; then + cmd_line=$(echo "$cmd_line --thin-client"); + fi + + if [ -n "$global_threading" ]; then + cmd_line=$(echo "$cmd_line --global-threading"); + fi + +#options with optional values start here + if [ -n "$fopen_keep_cache" ]; then + cmd_line=$(echo "$cmd_line --fopen-keep-cache=$fopen_keep_cache"); + fi + +#options with mandatory values start here + if [ -n "$halo_max_latency" ]; then + cmd_line=$(echo "$cmd_line --xlator-option \ + *replicate*.halo-max-latency=$halo_max_latency"); + fi + + if [ -n "$halo_max_replicas" ]; then + cmd_line=$(echo "$cmd_line --xlator-option \ + *replicate*.halo-max-replicas=$halo_max_replicas"); + fi + + if [ -n "$halo_min_replicas" ]; then + cmd_line=$(echo "$cmd_line --xlator-option \ + *replicate*.halo-min-replicas=$halo_min_replicas"); + fi + if [ -n "$log_level" ]; then cmd_line=$(echo "$cmd_line --log-level=$log_level"); fi @@ -202,6 +226,18 @@ start_glusterfs () cmd_line=$(echo "$cmd_line --use-readdirp=$use_readdirp"); fi + if [ -n "$event_history" ]; then + cmd_line=$(echo "$cmd_line --event-history=$event_history"); + fi + + if [ -n "$reader_thread_count" ]; then + cmd_line=$(echo "$cmd_line --reader-thread-count=$reader_thread_count"); + fi + + if [ -n "$fuse_auto_invalidation" ]; then + cmd_line=$(echo "$cmd_line --auto-invalidation=$fuse_auto_invalidation"); + fi + if [ -n "$volume_name" ]; then cmd_line=$(echo "$cmd_line --volume-name=$volume_name"); fi @@ -222,6 +258,14 @@ start_glusterfs () cmd_line=$(echo "$cmd_line --gid-timeout=$gid_timeout"); fi + if [ -n "$lru_limit" ]; then + cmd_line=$(echo "$cmd_line --lru-limit=$lru_limit"); + fi + + if [ -n "$invalidate_limit" ]; then + cmd_line=$(echo "$cmd_line --invalidate-limit=$invalidate_limit"); + fi + if [ -n "$bg_qlen" ]; then cmd_line=$(echo "$cmd_line --background-qlen=$bg_qlen"); fi @@ -230,6 +274,10 @@ start_glusterfs () cmd_line=$(echo "$cmd_line --congestion-threshold=$cong_threshold"); fi + if [ -n "$oom_score_adj" ]; then + cmd_line=$(echo "$cmd_line --oom-score-adj=$oom_score_adj"); + fi + if [ -n "$fuse_mountopts" ]; then cmd_line=$(echo "$cmd_line --fuse-mountopts=$fuse_mountopts"); fi @@ -238,6 +286,28 @@ start_glusterfs () cmd_line=$(echo "$cmd_line --xlator-option=$xlator_option"); fi + if [ -n "$kernel_writeback_cache" ]; then + cmd_line=$(echo "$cmd_line --kernel-writeback-cache=$kernel_writeback_cache"); + fi + + if [ -n "$attr_times_granularity" ]; then + cmd_line=$(echo "$cmd_line --attr-times-granularity=$attr_times_granularity"); + fi + + if [ -n "$dump_fuse" ]; then + cmd_line=$(echo "$cmd_line --dump-fuse=$dump_fuse"); + fi + + if [ -n "$fuse_flush_handle_interrupt" ]; then + cmd_line=$(echo "$cmd_line --fuse-flush-handle-interrupt=$fuse_flush_handle_interrupt"); + fi + + if [ -n "$process_name" ]; then + cmd_line=$(echo "$cmd_line --process-name fuse.$process_name"); + else + cmd_line=$(echo "$cmd_line --process-name fuse"); + fi + # if trasnport type is specified, we have to append it to # volume name, so that it fetches the right client vol file @@ -293,10 +363,21 @@ start_glusterfs () cmd_line=$(echo "$cmd_line --fuse-mountopts=$fuse_mountopts"); fi + if [ -n "$subdir_mount" ]; then + cmd_line=$(echo "$cmd_line --subdir-mount=/$subdir_mount"); + fi + + if [ -n "$fuse_dev_eperm_ratelimit_ns" ]; then + cmd_line=$(echo "$cmd_line --fuse-dev-eperm-ratelimit-ns=$fuse_dev_eperm_ratelimit_ns"); + fi + cmd_line=$(echo "$cmd_line $mount_point"); $cmd_line; if [ $? -ne 0 ]; then - warn "Mount failed. Please check the log file for more details." + # If this is true, then glusterfs process returned error without + # getting daemonized. We have made sure the logs are posted to + # 'stderr', so no need to point them to logfile. + warn "Mounting glusterfs on $mount_point failed." exit 1; fi @@ -304,7 +385,9 @@ start_glusterfs () inode=$( ${getinode} $mount_point 2>/dev/null); # this is required if the stat returns error if [ $? -ne 0 ]; then - warn "Mount failed. Please check the log file for more details." + # At this time, glusterfs got daemonized, and then later exited. + # These failures are only logged in log file. + warn "Mount failed. Check the log file ${log_file} for more details." umount $mount_point > /dev/null 2>&1; exit 1; fi @@ -313,9 +396,9 @@ start_glusterfs () print_usage () { cat << EOF -Usage: $0 <volumeserver>:<volumeid/volumeport> -o<options> <mountpoint> +Usage: $0 <server>:<volume/subdir> <mountpoint> -o<options> Options: -man 8 $0 +man 8 $(basename $0) To display the version number of the mount helper: $0 -V EOF } @@ -411,6 +494,9 @@ with_options() "volume-id") volume_id=$value ;; + "subdir-mount") + subdir_mount=$value + ;; "volfile-check") volfile_check=$value ;; @@ -429,6 +515,12 @@ with_options() "gid-timeout") gid_timeout=$value ;; + "lru-limit") + lru_limit=$value + ;; + "invalidate-limit") + invalidate_limit=$value + ;; "background-qlen") bg_qlen=$value ;; @@ -444,6 +536,9 @@ with_options() "congestion-threshold") cong_threshold=$value ;; + "oom-score-adj") + oom_score_adj=$value + ;; "xlator-option") xlator_option=$value ;; @@ -453,6 +548,15 @@ with_options() "use-readdirp") use_readdirp=$value ;; + "event-history") + event_history=$value + ;; + "reader-thread-count") + reader_thread_count=$value + ;; + "auto-invalidation") + fuse_auto_invalidation=$value + ;; "no-root-squash") if [ $value = "yes" ] || [ $value = "on" ] || @@ -467,11 +571,42 @@ with_options() [ $value = "false" ] ; then no_root_squash=1; fi ;; + "kernel-writeback-cache") + kernel_writeback_cache=$value + ;; + "attr-times-granularity") + attr_times_granularity=$value + ;; + "dump-fuse") + dump_fuse=$value + ;; + "fuse-flush-handle-interrupt") + fuse_flush_handle_interrupt=$value + ;; + "fuse-dev-eperm-ratelimit-ns") + fuse_dev_eperm_ratelimit_ns=$value + ;; "context"|"fscontext"|"defcontext"|"rootcontext") # standard SElinux mount options to pass to the kernel [ -z "$fuse_mountopts" ] || fuse_mountopts="$fuse_mountopts," fuse_mountopts="${fuse_mountopts}$key=\"$value\"" ;; + "halo-max-latency") + halo_max_latency=$value + ;; + "halo-max-replicas") + halo_max_replicas=$value + ;; + "halo-min-replicas") + halo_min_replicas=$value + ;; + "process-name") + process_name=$value + ;; + # Values that are optional + "fopen-keep-cache") + fopen_keep_cache="=$value" + ;; x-*) # comments or userspace application-specific options, drop them ;; @@ -499,9 +634,6 @@ without_options() "worm") worm=1 ;; - "fopen-keep-cache") - fopen_keep_cache=1 - ;; "enable-ino32") enable_ino32=1 ;; @@ -513,12 +645,18 @@ without_options() aux_gfid_mount=1 fi ;; + "thin-client") + thin_client=1 + ;; "resolve-gids") resolve_gids=1 ;; # "mount -t glusterfs" sends this, but it's useless. "rw") ;; + "global-threading") + global_threading=1 + ;; # TODO: not sure how to handle this yet "async"|"sync"|"dirsync"|\ "mand"|"nomand"|\ @@ -531,7 +669,7 @@ without_options() "atime"|"noatime"|"diratime"|"nodiratime"|\ "relatime"|"norelatime"|\ "strictatime"|"nostrictatime"|"lazyatime"|"nolazyatime"|\ - "dev"|"nodev"|"exec"|"noexec"|"suid"|"nosuid") + "dev"|"nodev"|"exec"|"noexec"|"suid"|"nosuid"|"auto_unmount") [ -z "$fuse_mountopts" ] || fuse_mountopts="$fuse_mountopts," fuse_mountopts="${fuse_mountopts}${option}" ;; @@ -540,6 +678,10 @@ without_options() ;; "_netdev") ;; + # Values that are optional + "fopen-keep-cache") + fopen_keep_cache="true" + ;; x-*) # comments or userspace application-specific options, drop them ;; @@ -581,14 +723,14 @@ update_updatedb() main () { - if [ "x${uname_s}" = "xLinux" ] ; then + if [ "x${uname_s}" = "xLinux" -a $# -ge 2 ] ; then volfile_loc=$1 mount_point=$2 ## `mount` specifies options as a last argument shift 2; fi - while getopts "Vo:hn" opt; do + while getopts "Vo:hns" opt; do case "${opt}" in o) parse_options ${OPTARG}; @@ -596,6 +738,9 @@ main () ;; n) ;; + s) + # accept+ignore sloppy mount, passed by autofs + ;; V) ${cmd_line} -V; exit 0; @@ -618,10 +763,22 @@ main () [ -r "$volfile_loc" ] || { # '%' included to support ipv6 link local addresses - server_ip=$(echo "$volfile_loc" | sed -n 's/\([a-zA-Z0-9:%.\-]*\):.*/\1/p'); + server_ip=$(echo "$volfile_loc" | sed -n 's/\([a-zA-Z0-9:%,.\-]*\):.*/\1/p'); volume_str=$(echo "$volfile_loc" | sed -n 's/.*:\([^ ]*\).*/\1/p'); [ -n "$volume_str" ] && { - volume_id="$volume_str"; + volume_id=$volume_str + volume_str_temp=$volume_str + first_char=$(echo "$volume_str" | cut -c 1) + [ ${first_char} = '/' ] && { + volume_str_temp=$(echo "$volume_str" | cut -c 2-) + } + volume_id_temp=$(echo "$volume_str_temp" | cut -f1 -d '/'); + [ $(echo $volume_str_temp | grep -c "/") -eq 1 ] && + [ "$volume_id_temp" != "snaps" ] && { + volume_id=$volume_id_temp; + [ ${first_char} = '/' ] && volume_id=/$volume_id; + subdir_mount=$(echo "$volume_str_temp" | cut -f2- -d '/'); + } } volfile_loc=""; [ -z "$volume_id" -o -z "$server_ip" ] && { @@ -659,7 +816,7 @@ EOF } # Simple check to avoid multiple identical mounts - if grep -q "[[:space:]+]${mount_point}[[:space:]+]fuse" $mounttab; then + if grep -q "[[:space:]+]${mount_point}[[:space:]+]fuse.glusterfs" $mounttab; then warn "$0: according to mtab, GlusterFS is already mounted on" \ "$mount_point" exit 32; |
