diff options
author | Igor Mammedov <niallain@gmail.com> | 2008-01-10 20:49:48 -0500 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2008-01-10 20:49:48 -0500 |
commit | e6ab15827eec0bc4444421f7ccf0223de321c708 (patch) | |
tree | 59fa8c7ad8247c45c0393f6f900460ab1e04a2f0 /fs/cifs/cifsfs.c | |
parent | 197c183f3526dc08aa52ca97ec66c268442d4b84 (diff) |
[CIFS] DFS support patchset: Added mountdata
Also cifs_fs_type was made not static for ussage in dfs code.
Signed-off-by: Igor Mammedov <niallain@gmail.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/cifsfs.c')
-rw-r--r-- | fs/cifs/cifsfs.c | 37 |
1 files changed, 36 insertions, 1 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 000b4a5d3219..93e107883a61 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -97,6 +97,9 @@ cifs_read_super(struct super_block *sb, void *data, | |||
97 | { | 97 | { |
98 | struct inode *inode; | 98 | struct inode *inode; |
99 | struct cifs_sb_info *cifs_sb; | 99 | struct cifs_sb_info *cifs_sb; |
100 | #ifdef CONFIG_CIFS_DFS_UPCALL | ||
101 | int len; | ||
102 | #endif | ||
100 | int rc = 0; | 103 | int rc = 0; |
101 | 104 | ||
102 | /* BB should we make this contingent on mount parm? */ | 105 | /* BB should we make this contingent on mount parm? */ |
@@ -106,6 +109,25 @@ cifs_read_super(struct super_block *sb, void *data, | |||
106 | if (cifs_sb == NULL) | 109 | if (cifs_sb == NULL) |
107 | return -ENOMEM; | 110 | return -ENOMEM; |
108 | 111 | ||
112 | #ifdef CONFIG_CIFS_DFS_UPCALL | ||
113 | /* copy mount params to sb for use in submounts */ | ||
114 | /* BB: should we move this after the mount so we | ||
115 | * do not have to do the copy on failed mounts? | ||
116 | * BB: May be it is better to do simple copy before | ||
117 | * complex operation (mount), and in case of fail | ||
118 | * just exit instead of doing mount and attempting | ||
119 | * undo it if this copy fails?*/ | ||
120 | len = strlen(data); | ||
121 | cifs_sb->mountdata = kzalloc(len + 1, GFP_KERNEL); | ||
122 | if (cifs_sb->mountdata == NULL) { | ||
123 | kfree(sb->s_fs_info); | ||
124 | sb->s_fs_info = NULL; | ||
125 | return -ENOMEM; | ||
126 | } | ||
127 | strncpy(cifs_sb->mountdata, data, len + 1); | ||
128 | cifs_sb->mountdata[len] = '\0'; | ||
129 | #endif | ||
130 | |||
109 | rc = cifs_mount(sb, cifs_sb, data, devname); | 131 | rc = cifs_mount(sb, cifs_sb, data, devname); |
110 | 132 | ||
111 | if (rc) { | 133 | if (rc) { |
@@ -155,6 +177,12 @@ out_no_root: | |||
155 | 177 | ||
156 | out_mount_failed: | 178 | out_mount_failed: |
157 | if (cifs_sb) { | 179 | if (cifs_sb) { |
180 | #ifdef CONFIG_CIFS_DFS_UPCALL | ||
181 | if (cifs_sb->mountdata) { | ||
182 | kfree(cifs_sb->mountdata); | ||
183 | cifs_sb->mountdata = NULL; | ||
184 | } | ||
185 | #endif | ||
158 | if (cifs_sb->local_nls) | 186 | if (cifs_sb->local_nls) |
159 | unload_nls(cifs_sb->local_nls); | 187 | unload_nls(cifs_sb->local_nls); |
160 | kfree(cifs_sb); | 188 | kfree(cifs_sb); |
@@ -178,6 +206,13 @@ cifs_put_super(struct super_block *sb) | |||
178 | if (rc) { | 206 | if (rc) { |
179 | cERROR(1, ("cifs_umount failed with return code %d", rc)); | 207 | cERROR(1, ("cifs_umount failed with return code %d", rc)); |
180 | } | 208 | } |
209 | #ifdef CONFIG_CIFS_DFS_UPCALL | ||
210 | if (cifs_sb->mountdata) { | ||
211 | kfree(cifs_sb->mountdata); | ||
212 | cifs_sb->mountdata = NULL; | ||
213 | } | ||
214 | #endif | ||
215 | |||
181 | unload_nls(cifs_sb->local_nls); | 216 | unload_nls(cifs_sb->local_nls); |
182 | kfree(cifs_sb); | 217 | kfree(cifs_sb); |
183 | return; | 218 | return; |
@@ -553,7 +588,7 @@ static loff_t cifs_llseek(struct file *file, loff_t offset, int origin) | |||
553 | return remote_llseek(file, offset, origin); | 588 | return remote_llseek(file, offset, origin); |
554 | } | 589 | } |
555 | 590 | ||
556 | static struct file_system_type cifs_fs_type = { | 591 | struct file_system_type cifs_fs_type = { |
557 | .owner = THIS_MODULE, | 592 | .owner = THIS_MODULE, |
558 | .name = "cifs", | 593 | .name = "cifs", |
559 | .get_sb = cifs_get_sb, | 594 | .get_sb = cifs_get_sb, |