aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2007-07-11 14:30:34 -0400
committerSteve French <sfrench@us.ibm.com>2007-07-11 14:30:34 -0400
commit7521a3c566dda7bb09576975324fc0a08a79ad14 (patch)
tree2ba0405ea1a7f3f187c2434ef86000b1b65f2d01 /fs/cifs
parentfb8c4b14d9259ba467241a7aaeb712caedce7ee8 (diff)
[CIFS] Fix oops in cifs_create when nfsd server exports cifs mount
nfsd is passing null nameidata (probably the only one doing that) on call to create - cifs was missing one check for this. Note that running nfsd over a cifs mount requires specifying fsid on the nfs exports entry and requires mounting cifs with serverino mount option. Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/CHANGES3
-rw-r--r--fs/cifs/README13
-rw-r--r--fs/cifs/cifsfs.c11
-rw-r--r--fs/cifs/dir.c3
-rw-r--r--fs/cifs/export.c15
-rw-r--r--fs/cifs/file.c2
6 files changed, 33 insertions, 14 deletions
diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES
index ee276f62bcf4..f92e0ee661ae 100644
--- a/fs/cifs/CHANGES
+++ b/fs/cifs/CHANGES
@@ -1,6 +1,7 @@
1Version 1.50 1Version 1.50
2------------ 2------------
3Fix NTLMv2 signing 3Fix NTLMv2 signing. NFS server mounted over cifs works (if cifs mount is
4done with "serverino" mount option).
4 5
5Version 1.49 6Version 1.49
6------------ 7------------
diff --git a/fs/cifs/README b/fs/cifs/README
index eb3efd5a6a81..85f1eb14083e 100644
--- a/fs/cifs/README
+++ b/fs/cifs/README
@@ -370,7 +370,7 @@ A partial list of the supported mount options follows:
370 Note that this does not affect the normal ACL check on the 370 Note that this does not affect the normal ACL check on the
371 target machine done by the server software (of the server 371 target machine done by the server software (of the server
372 ACL against the user name provided at mount time). 372 ACL against the user name provided at mount time).
373 serverino Use servers inode numbers instead of generating automatically 373 serverino Use server's inode numbers instead of generating automatically
374 incrementing inode numbers on the client. Although this will 374 incrementing inode numbers on the client. Although this will
375 make it easier to spot hardlinked files (as they will have 375 make it easier to spot hardlinked files (as they will have
376 the same inode numbers) and inode numbers may be persistent, 376 the same inode numbers) and inode numbers may be persistent,
@@ -378,12 +378,11 @@ A partial list of the supported mount options follows:
378 are unique if multiple server side mounts are exported under a 378 are unique if multiple server side mounts are exported under a
379 single share (since inode numbers on the servers might not 379 single share (since inode numbers on the servers might not
380 be unique if multiple filesystems are mounted under the same 380 be unique if multiple filesystems are mounted under the same
381 shared higher level directory). Note that this requires that 381 shared higher level directory). Note that some older
382 the server support the CIFS Unix Extensions as other servers 382 (e.g. pre-Windows 2000) do not support returning UniqueIDs
383 do not return a unique IndexNumber on SMB FindFirst (most 383 or the CIFS Unix Extensions equivalent and for those
384 servers return zero as the IndexNumber). Parameter has no 384 this mount option will have no effect. Exporting cifs mounts
385 effect to Windows servers and others which do not support the 385 under nfsd requires this mount option on the cifs mount.
386 CIFS Unix Extensions.
387 noserverino Client generates inode numbers (rather than using the actual one 386 noserverino Client generates inode numbers (rather than using the actual one
388 from the server) by default. 387 from the server) by default.
389 setuids If the CIFS Unix extensions are negotiated with the server 388 setuids If the CIFS Unix extensions are negotiated with the server
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 17ed7cf750af..40f35f0263ac 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -114,10 +114,6 @@ cifs_read_super(struct super_block *sb, void *data,
114 114
115 sb->s_magic = CIFS_MAGIC_NUMBER; 115 sb->s_magic = CIFS_MAGIC_NUMBER;
116 sb->s_op = &cifs_super_ops; 116 sb->s_op = &cifs_super_ops;
117#ifdef CONFIG_CIFS_EXPERIMENTAL
118 if (experimEnabled != 0)
119 sb->s_export_op = &cifs_export_ops;
120#endif /* EXPERIMENTAL */
121/* if (cifs_sb->tcon->ses->server->maxBuf > MAX_CIFS_HDR_SIZE + 512) 117/* if (cifs_sb->tcon->ses->server->maxBuf > MAX_CIFS_HDR_SIZE + 512)
122 sb->s_blocksize = 118 sb->s_blocksize =
123 cifs_sb->tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE; */ 119 cifs_sb->tcon->ses->server->maxBuf - MAX_CIFS_HDR_SIZE; */
@@ -139,6 +135,13 @@ cifs_read_super(struct super_block *sb, void *data,
139 rc = -ENOMEM; 135 rc = -ENOMEM;
140 goto out_no_root; 136 goto out_no_root;
141 } 137 }
138
139#ifdef CONFIG_CIFS_EXPERIMENTAL
140 if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SERVER_INUM) {
141 cFYI(1, ("export ops supported"));
142 sb->s_export_op = &cifs_export_ops;
143 }
144#endif /* EXPERIMENTAL */
142 145
143 return 0; 146 return 0;
144 147
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
index 38706e8496a3..def89f23fe55 100644
--- a/fs/cifs/dir.c
+++ b/fs/cifs/dir.c
@@ -264,7 +264,8 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
264 direntry->d_op = &cifs_dentry_ops; 264 direntry->d_op = &cifs_dentry_ops;
265 d_instantiate(direntry, newinode); 265 d_instantiate(direntry, newinode);
266 } 266 }
267 if ((nd->flags & LOOKUP_OPEN) == FALSE) { 267 if ((nd == NULL /* nfsd case - nfs srv does not set nd */) ||
268 ((nd->flags & LOOKUP_OPEN) == FALSE)) {
268 /* mknod case - do not leave file open */ 269 /* mknod case - do not leave file open */
269 CIFSSMBClose(xid, pTcon, fileHandle); 270 CIFSSMBClose(xid, pTcon, fileHandle);
270 } else if (newinode) { 271 } else if (newinode) {
diff --git a/fs/cifs/export.c b/fs/cifs/export.c
index 5a08effda0ae..6e66bc19f0ae 100644
--- a/fs/cifs/export.c
+++ b/fs/cifs/export.c
@@ -26,15 +26,30 @@
26 /* 26 /*
27 * See Documentation/filesystems/Exporting 27 * See Documentation/filesystems/Exporting
28 * and examples in fs/exportfs 28 * and examples in fs/exportfs
29 *
30 * Since cifs is a network file system, an "fsid" must be included for
31 * any nfs exports file entries which refer to cifs paths. In addition
32 * the cifs mount must be mounted with the "serverino" option (ie use stable
33 * server inode numbers instead of locally generated temporary ones).
34 * Although cifs inodes do not use generation numbers (have generation number
35 * of zero) - the inode number alone should be good enough for simple cases
36 * in which users want to export cifs shares with NFS. The decode and encode
37 * could be improved by using a new routine which expects 64 bit inode numbers
38 * instead of the default 32 bit routines in fs/exportfs
39 *
29 */ 40 */
30 41
31#include <linux/fs.h> 42#include <linux/fs.h>
43#include "cifsglob.h"
44#include "cifs_debug.h"
45
32 46
33#ifdef CONFIG_CIFS_EXPERIMENTAL 47#ifdef CONFIG_CIFS_EXPERIMENTAL
34 48
35static struct dentry *cifs_get_parent(struct dentry *dentry) 49static struct dentry *cifs_get_parent(struct dentry *dentry)
36{ 50{
37 /* BB need to add code here eventually to enable export via NFSD */ 51 /* BB need to add code here eventually to enable export via NFSD */
52 cFYI(1, ("get parent for %p", dentry));
38 return ERR_PTR(-EACCES); 53 return ERR_PTR(-EACCES);
39} 54}
40 55
diff --git a/fs/cifs/file.c b/fs/cifs/file.c
index 7d6fb6f3adeb..d83eca4231e7 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -212,7 +212,7 @@ int cifs_open(struct inode *inode, struct file *file)
212 return -ENOMEM; 212 return -ENOMEM;
213 } 213 }
214 214
215 cFYI(1, (" inode = 0x%p file flags are 0x%x for %s", 215 cFYI(1, ("inode = 0x%p file flags are 0x%x for %s",
216 inode, file->f_flags, full_path)); 216 inode, file->f_flags, full_path));
217 desiredAccess = cifs_convert_flags(file->f_flags); 217 desiredAccess = cifs_convert_flags(file->f_flags);
218 218