diff options
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r-- | fs/cifs/connect.c | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index 32fa4d9b5dbc..cc1a8604a790 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -105,6 +105,7 @@ struct smb_vol { | |||
105 | unsigned int wsize; | 105 | unsigned int wsize; |
106 | bool sockopt_tcp_nodelay:1; | 106 | bool sockopt_tcp_nodelay:1; |
107 | unsigned short int port; | 107 | unsigned short int port; |
108 | unsigned long actimeo; /* attribute cache timeout (jiffies) */ | ||
108 | char *prepath; | 109 | char *prepath; |
109 | struct sockaddr_storage srcaddr; /* allow binding to a local IP */ | 110 | struct sockaddr_storage srcaddr; /* allow binding to a local IP */ |
110 | struct nls_table *local_nls; | 111 | struct nls_table *local_nls; |
@@ -806,23 +807,20 @@ cifs_parse_mount_options(char *options, const char *devname, | |||
806 | short int override_gid = -1; | 807 | short int override_gid = -1; |
807 | bool uid_specified = false; | 808 | bool uid_specified = false; |
808 | bool gid_specified = false; | 809 | bool gid_specified = false; |
810 | char *nodename = utsname()->nodename; | ||
809 | 811 | ||
810 | separator[0] = ','; | 812 | separator[0] = ','; |
811 | separator[1] = 0; | 813 | separator[1] = 0; |
812 | 814 | ||
813 | if (Local_System_Name[0] != 0) | 815 | /* |
814 | memcpy(vol->source_rfc1001_name, Local_System_Name, 15); | 816 | * does not have to be perfect mapping since field is |
815 | else { | 817 | * informational, only used for servers that do not support |
816 | char *nodename = utsname()->nodename; | 818 | * port 445 and it can be overridden at mount time |
817 | int n = strnlen(nodename, 15); | 819 | */ |
818 | memset(vol->source_rfc1001_name, 0x20, 15); | 820 | memset(vol->source_rfc1001_name, 0x20, 15); |
819 | for (i = 0; i < n; i++) { | 821 | for (i = 0; i < strnlen(nodename, 15); i++) |
820 | /* does not have to be perfect mapping since field is | 822 | vol->source_rfc1001_name[i] = toupper(nodename[i]); |
821 | informational, only used for servers that do not support | 823 | |
822 | port 445 and it can be overridden at mount time */ | ||
823 | vol->source_rfc1001_name[i] = toupper(nodename[i]); | ||
824 | } | ||
825 | } | ||
826 | vol->source_rfc1001_name[15] = 0; | 824 | vol->source_rfc1001_name[15] = 0; |
827 | /* null target name indicates to use *SMBSERVR default called name | 825 | /* null target name indicates to use *SMBSERVR default called name |
828 | if we end up sending RFC1001 session initialize */ | 826 | if we end up sending RFC1001 session initialize */ |
@@ -840,6 +838,8 @@ cifs_parse_mount_options(char *options, const char *devname, | |||
840 | /* default to using server inode numbers where available */ | 838 | /* default to using server inode numbers where available */ |
841 | vol->server_ino = 1; | 839 | vol->server_ino = 1; |
842 | 840 | ||
841 | vol->actimeo = CIFS_DEF_ACTIMEO; | ||
842 | |||
843 | if (!options) | 843 | if (!options) |
844 | return 1; | 844 | return 1; |
845 | 845 | ||
@@ -1214,6 +1214,16 @@ cifs_parse_mount_options(char *options, const char *devname, | |||
1214 | printk(KERN_WARNING "CIFS: server net" | 1214 | printk(KERN_WARNING "CIFS: server net" |
1215 | "biosname longer than 15 truncated.\n"); | 1215 | "biosname longer than 15 truncated.\n"); |
1216 | } | 1216 | } |
1217 | } else if (strnicmp(data, "actimeo", 7) == 0) { | ||
1218 | if (value && *value) { | ||
1219 | vol->actimeo = HZ * simple_strtoul(value, | ||
1220 | &value, 0); | ||
1221 | if (vol->actimeo > CIFS_MAX_ACTIMEO) { | ||
1222 | cERROR(1, "CIFS: attribute cache" | ||
1223 | "timeout too large"); | ||
1224 | return 1; | ||
1225 | } | ||
1226 | } | ||
1217 | } else if (strnicmp(data, "credentials", 4) == 0) { | 1227 | } else if (strnicmp(data, "credentials", 4) == 0) { |
1218 | /* ignore */ | 1228 | /* ignore */ |
1219 | } else if (strnicmp(data, "version", 3) == 0) { | 1229 | } else if (strnicmp(data, "version", 3) == 0) { |
@@ -2571,6 +2581,8 @@ static void setup_cifs_sb(struct smb_vol *pvolume_info, | |||
2571 | cFYI(1, "file mode: 0x%x dir mode: 0x%x", | 2581 | cFYI(1, "file mode: 0x%x dir mode: 0x%x", |
2572 | cifs_sb->mnt_file_mode, cifs_sb->mnt_dir_mode); | 2582 | cifs_sb->mnt_file_mode, cifs_sb->mnt_dir_mode); |
2573 | 2583 | ||
2584 | cifs_sb->actimeo = pvolume_info->actimeo; | ||
2585 | |||
2574 | if (pvolume_info->noperm) | 2586 | if (pvolume_info->noperm) |
2575 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_PERM; | 2587 | cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_NO_PERM; |
2576 | if (pvolume_info->setuids) | 2588 | if (pvolume_info->setuids) |
@@ -2821,13 +2833,13 @@ remote_path_check: | |||
2821 | /* check if a whole path (including prepath) is not remote */ | 2833 | /* check if a whole path (including prepath) is not remote */ |
2822 | if (!rc && cifs_sb->prepathlen && tcon) { | 2834 | if (!rc && cifs_sb->prepathlen && tcon) { |
2823 | /* build_path_to_root works only when we have a valid tcon */ | 2835 | /* build_path_to_root works only when we have a valid tcon */ |
2824 | full_path = cifs_build_path_to_root(cifs_sb); | 2836 | full_path = cifs_build_path_to_root(cifs_sb, tcon); |
2825 | if (full_path == NULL) { | 2837 | if (full_path == NULL) { |
2826 | rc = -ENOMEM; | 2838 | rc = -ENOMEM; |
2827 | goto mount_fail_check; | 2839 | goto mount_fail_check; |
2828 | } | 2840 | } |
2829 | rc = is_path_accessible(xid, tcon, cifs_sb, full_path); | 2841 | rc = is_path_accessible(xid, tcon, cifs_sb, full_path); |
2830 | if (rc != -EREMOTE) { | 2842 | if (rc != 0 && rc != -EREMOTE) { |
2831 | kfree(full_path); | 2843 | kfree(full_path); |
2832 | goto mount_fail_check; | 2844 | goto mount_fail_check; |
2833 | } | 2845 | } |