[linux-cifs-client] cifs client 1.45 for 2.4.x missing directory listings

Schultz, Dale C. D.Schultz at telesat.ca
Fri Sep 29 01:28:09 GMT 2006


Hello:
Below is a very helpful exchange I've had with Yehuda about the operation of the cifs client on 2.4 kernels.  In short I think this problem I'm having is similar to bug 1304 (https://bugzilla.samba.org/show_bug.cgi?id=1304).
I was using cifs 1.20c on a 2.4.19 Mandrake kernel to mount multiple remote shares on the same NetApp filer.  I would get intermittent directory listing with 'ls'.
I thought upgrading to the latest version 1.45 would solve the problem.  With Yehuda's help I was able to get 1.45 complied and operational on my 2.4 kernel, but the problem remains.
If anyone can offer a patch for version 1.20c or 1.45 for kernel 2.4 I'll gladly give it a try.
Thanks.
Dale

________________________________

From: Schultz, Dale C.
Sent: Thu 9/28/2006 7:56 PM
To: 'Yehuda Sadeh Weinraub'
 

Hi:

As you suggested I compiled cifs version 1.45 on my 2.6.12-12mdk kernel machine (cifs was at version 1.34).

I did a ls -R on the mount point before and after the change of the cifs.ko module and both outputs have the same number of lines in the capture.

wc output:

54855  514143 3376540 /home/dale/filer_134_dir.txt

---

54855  514143 3376063 /home/dale/filer_145_dir.txt

 

only about 500 bytes difference.

 

So this would seem to suggest that the problem lies in the backport to the 2.4 kernel as you hinted to.

 

I can email the list... it may help someone else someday if this gets archived.

 

Thanks for all your help.

Dale

 

-----Original Message-----
From: Yehuda Sadeh Weinraub [mailto:Yehuda.Sadeh at expand.com] 
Sent: Thursday, September 28, 2006 2:29 PM
To: Schultz, Dale C.


 

I'm not sure I will be able to get into it before tuesday, so maybe sending this question to the linux-cifs-client list might be a good idea. I saw the same problem you described with the old version of the module, but not with the newer one (I've tested it against a Netapp simulator, version 6.X). However, I haven't checked the exact version that you have, so maybe one of the fixes broke it. If you're in to it, you can try to compile the same module version against your 2.6 kernel, and try to run it there, so we're sure that the problem is in the 2.4 port. I'm not sure that the tcpdump will help here as this was a known bug that was fixed. Maybe trying to debug the cifs_readdir() function might help here. 

 

Yehuda

 

________________________________

From: Yehuda Sadeh Weinraub
Sent: ? 28/09/2006 20:54
To: Schultz, Dale C. [mailto:D.Schultz at telesat.ca]

Thanks for pointing me in the right direction.  I was using a different .config file so I copied the one saved in the /boot/ directory over to the source directory and used it.  I disabled the POSIX option (and statistics) and recompiled.  I still get the unused variable codepage warning but at least now the unresolved symbol issue has been resolved.  The module is loaded and I can once again mount remote shares.

 

Now that I'm past all that...I still have the same issue with the newer code as I did with the older code.  When I do an 'ls' on a cifs mounted share on the NetApp I will intermittently get a listing.  If I do it repeatedly sometimes I get a listing and sometimes I don't.  I captured an IP trace with tcpdump and if I sift through the payload I can see that the server is sending the directory listing but there is no output from the 'ls' command.  I tried a couple of cifs options such as 'direct' (that made things worst) and serverino (unsupported according to output in kernel log) without any luck.

 

At a low level this is the problem that I see.  Higher up, I use the mounted shares as a repository of info available via my apache web server.  If I browse the remote share via the web interface I get the same result, no dir listings.  If I specify the full URL to a file there is no impact on accessing the file, it is always displayed.  The problem is that I don't link to all the files, sometimes I just provide a link to the directory and let the user pick a file from the listing, but without a listing the directory appears empty.

 

I can provide some traces (tcpdump) or cifs module debug if you are able to assist in debugging this issue with me, just let me know what you are interested in.  Or if there is another avenue for support just let me know.

 

Here is the DebugData for my shares (two against the NetApp filer and one against a Win2003 Server):

[root at vsat linux]# cat /proc/fs/cifs/DebugData

Display Internal CIFS Data Structures for Debugging

---------------------------------------------------

Servers:

 

1) Name: 98.180.10.8  Domain: TELESAT Mounts: 1 ServerOS: Windows Server 2003 3790 Service Pack 1

        ServerNOS: Windows Server 2003 5.2      Capabilities: 0x1f3fd

        SMB session status: 3   TCP status: 1

        Local Users To Server: 1 SecMode: 0xf Req Active: 0

MIDs:

 

2) Name: 172.16.2.188  Domain: TELESAT Mounts: 2 ServerOS: Windows 5.0

        ServerNOS: Windows 2000 LAN Manager     Capabilities: 0xd3fd

        SMB session status: 1   TCP status: 1

        Local Users To Server: 1 SecMode: 0x3 Req Active: 0

MIDs:

 

 

Shares:

 

1) \\hqdfiler\Business Devel Uses: 1 Type: NTFS Characteristics: 0x20 Attributes: 0x4000f

PathComponentMax: 255 Status: 1 type: DISK

2) \\T25-SERVER\T25 Data Uses: 1 Type: NTFS Characteristics: 0x20 Attributes: 0x700ff

PathComponentMax: 255 Status: 3 type: DISK

3) \\hqdfiler\ds1350 Uses: 1 Type: NTFS Characteristics: 0x20 Attributes: 0x4000f

PathComponentMax: 255 Status: 1 type: DISK

 

Thanks.

Dale

 

-----Original Message-----
From: Yehuda Sadeh Weinraub [mailto:Yehuda.Sadeh at expand.com] 
Sent: Thursday, September 28, 2006 2:14 AM
To: Schultz, Dale C.
Subject: RE: [linux-cifs-client] cifs 1.45 for 2.4.x

 

It looks like two different issues. First, you should disable the CONFIG_CIFS_POSIX option, so that it doesn't compile. This feature hasn't been backported, and I guess you haven't used it since the old version didn't really implement it. The first two warnings are ok.

The second issue is that there is a mismatch between the kernel on the machine and the kernel that the module was compiled against (probably different configuration). I've seen similar messages when tried to run a module that was compiled against sources for Intel processors and the machine was running a kernel for AMD. In any case, you should use the appropriate .config file. Another solution is to recompile the kernel with the current configuration and to install the new kernel on the machine. In any case, the module and the running kernel should be compiled with the same configuration.

 

________________________________

From: Schultz, Dale C. [mailto:D.Schultz at telesat.ca] 
Sent: Thursday, September 28, 2006 6:02 AM
To: Yehuda Sadeh Weinraub


 

Hi again:

I've applied your patch to the latest version (83) without any issues.

 

I then complied with only a couple of warnings.

dir.c: In function `cifs_ci_hash':

dir.c:605: warning: unused variable `codepage'

dir.c: In function `cifs_ci_compare':

dir.c:621: warning: unused variable `codepage'

ioctl.c: In function `cifs_ioctl':

ioctl.c:84: warning: implicit declaration of function `put_user'

ioctl.c:92: warning: implicit declaration of function `get_user'

 

But I can't get the module to load.  This is the result of loading:

[root at vsat linux]# modprobe cifs

/lib/modules/2.4.19-16mdksecure/kernel/fs/cifs/cifs.o: unresolved symbol sock_sendmsg_Rsmp_86023ef6

/lib/modules/2.4.19-16mdksecure/kernel/fs/cifs/cifs.o: unresolved symbol get_user

/lib/modules/2.4.19-16mdksecure/kernel/fs/cifs/cifs.o: unresolved symbol CIFSGetExtAttr

/lib/modules/2.4.19-16mdksecure/kernel/fs/cifs/cifs.o: unresolved symbol sock_create_Rsmp_f6e3fc39

/lib/modules/2.4.19-16mdksecure/kernel/fs/cifs/cifs.o: unresolved symbol sock_release_Rsmp_31833bf8

/lib/modules/2.4.19-16mdksecure/kernel/fs/cifs/cifs.o: unresolved symbol sock_recvmsg_Rsmp_b49e9a9e

/lib/modules/2.4.19-16mdksecure/kernel/fs/cifs/cifs.o: unresolved symbol put_user

modprobe: insmod /lib/modules/2.4.19-16mdksecure/kernel/fs/cifs/cifs.o failed

modprobe: insmod cifs failed

 

Is there any way to correct this?

Thanks.

Dale

 

-----Original Message-----
From: Yehuda Sadeh Weinraub [mailto:Yehuda.Sadeh at expand.com] 
Sent: Wednesday, September 27, 2006 3:57 AM
To: Schultz, Dale C.


Sure.

 

This patch applies to the latest sources from the svn tree:

svn co svn://svnanon.samba.org/linux-cifs-client/branches/linux-converged-for-old-kernels

 

Note that it's quite a different patch than the one I've sent to  the list, since some of it is already committed in the svn, and some other stuff was fixed a bit differently by Steve French. I've added a few lines to make it compile against 2.4.19 vanilla, but I haven't checked this version, so please let me know if you encounter any problems.

 

Yehuda

 

________________________________

From: Schultz, Dale C. [mailto:D.Schultz at telesat.ca] 
Sent: Tuesday, September 26, 2006 10:34 PM
To: Yehuda Sadeh Weinraub


Hello:

I have a Mandrake installation using kernel 2.4.19.  I'm currently using CIFS version 1.20c patched for the 2.4 kernel.  I'd like to update CIFS to a more recent version as I'm loosing directory listing when mounted against a Network Appliance (NetApp) filer.  This doesn't seem to happen on a temporary 2.6 kernel server I loaded.

Can you provide me all the patch files you used against CIFS 1.45 to compile against version 2.4 kernel?  The ones on the mail list are mangled at the 70 character limit.

Thanks.

Dale

-------------- next part --------------
Index: fs/cifs/cifsfs24.c
===================================================================
--- fs/cifs/cifsfs24.c	(revision 83)
+++ fs/cifs/cifsfs24.c	(working copy)
@@ -40,9 +40,6 @@
 #include "cifs_debug.h"
 #include "cifs_fs_sb.h"
 #include <linux/mm.h>
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 4, 25))
-#include <linux/moduleparam.h>
-#endif
 #define CIFS_MAGIC_NUMBER 0xFF534D42	/* the first four bytes of SMB PDUs */
 
 #ifdef CONFIG_CIFS_QUOTA
@@ -249,18 +246,7 @@
 	cifs_inode = kmem_cache_alloc(cifs_inode_cachep, SLAB_KERNEL);
 	if (!cifs_inode)
 		return NULL;
-	cifs_inode->cifsAttrs = 0x20;	/* default */
-	atomic_set(&cifs_inode->inUse, 0);
-	cifs_inode->time = 0;
-	/* Until the file is open and we have gotten oplock
-	info back from the server, can not assume caching of
-	file data or metadata */
-	cifs_inode->clientCanCacheRead = FALSE;
-	cifs_inode->clientCanCacheAll = FALSE;
-	cifs_inode->vfs_inode.i_blksize = CIFS_MAX_MSGSIZE;
-	cifs_inode->vfs_inode.i_blkbits = 14;  /* 2**14 = CIFS_MAX_MSGSIZE */
-	cifs_inode->vfs_inode.i_flags = S_NOATIME | S_NOCMTIME;
-	INIT_LIST_HEAD(&cifs_inode->openFileList);
+    cifs_init_inode(&cifs_inode->vfs_inode);
 	return &cifs_inode->vfs_inode;
 }
 #endif
Index: fs/cifs/inode.c
===================================================================
--- fs/cifs/inode.c	(revision 83)
+++ fs/cifs/inode.c	(working copy)
@@ -32,6 +32,45 @@
 #include <linux/buffer_head.h>
 #endif
 
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)
+#define CIFS_INODE_FLAGS S_NOATIME | S_NOCMTIME
+#else
+#define CIFS_INODE_FLAGS S_NOATIME
+#endif
+
+void cifs_init_inode(struct inode *inode)
+{
+    struct cifsInodeInfo *cifs_inode;
+
+    cifs_inode = CIFS_I(inode);
+
+	cifs_inode->cifsAttrs = 0x20;	/* default */
+	atomic_set(&cifs_inode->inUse, 0);
+	cifs_inode->time = 0;
+	/* Until the file is open and we have gotten oplock
+	info back from the server, can not assume caching of
+	file data or metadata */
+	cifs_inode->clientCanCacheRead = FALSE;
+	cifs_inode->clientCanCacheAll = FALSE;
+	inode->i_blksize = CIFS_MAX_MSGSIZE;
+	inode->i_blkbits = 14;  /* 2**14 = CIFS_MAX_MSGSIZE */
+	inode->i_flags = CIFS_INODE_FLAGS;
+	INIT_LIST_HEAD(&cifs_inode->openFileList);
+}
+
+struct inode * get_cifs_inode(struct super_block * sb)
+{
+    struct inode * newinode;
+    newinode = new_inode(sb);
+    cFYI(1,("got new inode %p",newinode));
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
+    if(newinode) {
+        cifs_init_inode(newinode);
+    }
+#endif
+    return newinode;
+}
+
 int cifs_get_inode_info_unix(struct inode **pinode,
 	const unsigned char *search_path, struct super_block *sb, int xid)
 {
@@ -83,7 +122,7 @@
 
 		/* get new inode */
 		if (*pinode == NULL) {
-			*pinode = new_inode(sb);
+			*pinode = get_cifs_inode(sb);
 			if (*pinode == NULL) 
 				return -ENOMEM;
 			/* Is an i_ino of zero legal? */
@@ -172,16 +211,17 @@
 			inode->i_op = &cifs_file_inode_ops;
 			if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) {
 				if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
-					inode->i_fop = 
+					(const struct file_operations *)(inode->i_fop) = 
 						&cifs_file_direct_nobrl_ops;
 				else
-					inode->i_fop = &cifs_file_direct_ops;
+					(const struct file_operations *)(inode->i_fop) = 
+                        &cifs_file_direct_ops;
 			} else if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
-				inode->i_fop = &cifs_file_nobrl_ops;
+				(const struct file_operations *)(inode->i_fop) = &cifs_file_nobrl_ops;
 			else /* not direct, send byte range locks */ 
-				inode->i_fop = &cifs_file_ops;
+				(const struct file_operations *)(inode->i_fop) = &cifs_file_ops;
 
-			inode->i_data.a_ops = &cifs_addr_ops;
+			(const struct address_space_operations *)(inode->i_data.a_ops) = &cifs_addr_ops;
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)
 			/* check if server can support readpages */
 			if(pTcon->ses->server->maxBuf < 
@@ -191,7 +231,7 @@
 		} else if (S_ISDIR(inode->i_mode)) {
 			cFYI(1, ("Directory inode"));
 			inode->i_op = &cifs_dir_inode_ops;
-			inode->i_fop = &cifs_dir_ops;
+			(const struct file_operations *)(inode->i_fop) = &cifs_dir_ops;
 		} else if (S_ISLNK(inode->i_mode)) {
 			cFYI(1, ("Symbolic Link inode"));
 			inode->i_op = &cifs_symlink_inode_ops;
@@ -386,7 +426,7 @@
 
 		/* get new inode */
 		if (*pinode == NULL) {
-			*pinode = new_inode(sb);
+			*pinode = get_cifs_inode(sb);
 			if (*pinode == NULL)
 				return -ENOMEM;
 			/* Is an i_ino of zero legal? Can we use that to check
@@ -513,16 +553,17 @@
 			inode->i_op = &cifs_file_inode_ops;
 			if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) {
 				if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
-					inode->i_fop =
+					(const struct file_operations *)(inode->i_fop) =
 						&cifs_file_direct_nobrl_ops;
 				else
-					inode->i_fop = &cifs_file_direct_ops;
+					(const struct file_operations *)(inode->i_fop) = 
+                        &cifs_file_direct_ops;
 			} else if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
-				inode->i_fop = &cifs_file_nobrl_ops;
+				(const struct file_operations *)(inode->i_fop) = &cifs_file_nobrl_ops;
 			else /* not direct, send byte range locks */
-				inode->i_fop = &cifs_file_ops;
+				(const struct file_operations *)(inode->i_fop) = &cifs_file_ops;
 
-			inode->i_data.a_ops = &cifs_addr_ops;
+			(const struct address_space_operations *)(inode->i_data.a_ops) = &cifs_addr_ops;
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)
 			if(pTcon->ses->server->maxBuf < 
 			     PAGE_CACHE_SIZE + MAX_CIFS_HDR_SIZE)
@@ -531,7 +572,7 @@
 		} else if (S_ISDIR(inode->i_mode)) {
 			cFYI(1, ("Directory inode"));
 			inode->i_op = &cifs_dir_inode_ops;
-			inode->i_fop = &cifs_dir_ops;
+			(const struct file_operations *)(inode->i_fop) = &cifs_dir_ops;
 		} else if (S_ISLNK(inode->i_mode)) {
 			cFYI(1, ("Symbolic Link inode"));
 			inode->i_op = &cifs_symlink_inode_ops;
@@ -550,6 +591,10 @@
 	int xid;
 	struct cifs_sb_info *cifs_sb;
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 5, 0)
+    cifs_init_inode(inode);
+#endif
+
 	cifs_sb = CIFS_SB(inode->i_sb);
 	xid = GetXid();
 	if (cifs_sb->tcon->ses->capabilities & CAP_UNIX)
Index: fs/cifs/readdir.c
===================================================================
--- fs/cifs/readdir.c	(revision 83)
+++ fs/cifs/readdir.c	(working copy)
@@ -78,7 +78,7 @@
 		*ptmp_inode = tmp_dentry->d_inode;
 /* BB overwrite old name? i.e. tmp_dentry->d_name and tmp_dentry->d_name.len??*/
 		if(*ptmp_inode == NULL) {
-			*ptmp_inode = new_inode(file->f_dentry->d_sb);
+			*ptmp_inode = get_cifs_inode(file->f_dentry->d_sb);
 			if(*ptmp_inode == NULL)
 				return rc;
 			rc = 1;
@@ -91,7 +91,7 @@
 			return rc;
 		}
 
-		*ptmp_inode = new_inode(file->f_dentry->d_sb);
+		*ptmp_inode = get_cifs_inode(file->f_dentry->d_sb);
 		if (pTcon->nocase)
 			tmp_dentry->d_op = &cifs_ci_dentry_ops;
 		else
@@ -229,14 +229,14 @@
 		tmp_inode->i_op = &cifs_file_inode_ops;
 		if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) {
 			if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
-				tmp_inode->i_fop = &cifs_file_direct_nobrl_ops;
+				(const struct file_operations *)(tmp_inode->i_fop) = &cifs_file_direct_nobrl_ops;
 			else
-				tmp_inode->i_fop = &cifs_file_direct_ops;
+				(const struct file_operations *)(tmp_inode->i_fop) = &cifs_file_direct_ops;
 		
 		} else if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
-			tmp_inode->i_fop = &cifs_file_nobrl_ops;
+			(const struct file_operations *)(tmp_inode->i_fop) = &cifs_file_nobrl_ops;
 		else
-			tmp_inode->i_fop = &cifs_file_ops;
+			(const struct file_operations *)(tmp_inode->i_fop) = &cifs_file_ops;
 
 		if((cifs_sb->tcon) && (cifs_sb->tcon->ses) &&
 		   (cifs_sb->tcon->ses->server->maxBuf <
@@ -261,7 +261,7 @@
 	} else if (S_ISDIR(tmp_inode->i_mode)) {
 		cFYI(1, ("Directory inode"));
 		tmp_inode->i_op = &cifs_dir_inode_ops;
-		tmp_inode->i_fop = &cifs_dir_ops;
+		(const struct file_operations *)(tmp_inode->i_fop) = &cifs_dir_ops;
 	} else if (S_ISLNK(tmp_inode->i_mode)) {
 		cFYI(1, ("Symbolic Link inode"));
 		tmp_inode->i_op = &cifs_symlink_inode_ops;
@@ -358,14 +358,14 @@
 
 		if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_DIRECT_IO) {
 			if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
-				tmp_inode->i_fop = &cifs_file_direct_nobrl_ops;
+				(const struct file_operations *)(tmp_inode->i_fop) = &cifs_file_direct_nobrl_ops;
 			else
-				tmp_inode->i_fop = &cifs_file_direct_ops;
+				(const struct file_operations *)(tmp_inode->i_fop) = &cifs_file_direct_ops;
 		
 		} else if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_BRL)
-			tmp_inode->i_fop = &cifs_file_nobrl_ops;
+			(const struct file_operations *)(tmp_inode->i_fop) = &cifs_file_nobrl_ops;
 		else
-			tmp_inode->i_fop = &cifs_file_ops;
+			(const struct file_operations *)(tmp_inode->i_fop) = &cifs_file_ops;
 
 		if((cifs_sb->tcon) && (cifs_sb->tcon->ses) &&
 		   (cifs_sb->tcon->ses->server->maxBuf < 
@@ -389,7 +389,7 @@
 	} else if (S_ISDIR(tmp_inode->i_mode)) {
 		cFYI(1, ("Directory inode"));
 		tmp_inode->i_op = &cifs_dir_inode_ops;
-		tmp_inode->i_fop = &cifs_dir_ops;
+		(const struct file_operations *)(tmp_inode->i_fop) = &cifs_dir_ops;
 	} else if (S_ISLNK(tmp_inode->i_mode)) {
 		cFYI(1, ("Symbolic Link inode"));
 		tmp_inode->i_op = &cifs_symlink_inode_ops;
Index: fs/cifs/cifsproto.h
===================================================================
--- fs/cifs/cifsproto.h	(revision 83)
+++ fs/cifs/cifsproto.h	(working copy)
@@ -33,6 +33,10 @@
 #define msleep(x) { set_current_state(TASK_UNINTERRUPTIBLE); schedule_timeout(x * HZ / 1000); }
 #endif
 
+#ifndef __user
+#define __user
+#endif
+
 /*
  *****************************************************************
  * All Prototypes
Index: fs/cifs/file.c
===================================================================
--- fs/cifs/file.c	(revision 83)
+++ fs/cifs/file.c	(working copy)
@@ -1061,7 +1061,9 @@
 
 	if(cifs_inode == NULL) {
 		cERROR(1,("Null inode passed to cifs_writeable_file"));
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 4, 19)
 		dump_stack();
+#endif
 		return NULL;
 	}
 
@@ -2047,7 +2049,11 @@
 	return 0;
 }
 
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)
 const struct address_space_operations cifs_addr_ops = {
+#else
+struct address_space_operations cifs_addr_ops = {
+#endif
 	.readpage = cifs_readpage,
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)
 	.readpages = cifs_readpages,
@@ -2070,7 +2076,11 @@
  * contain the header plus one complete page of data.  Otherwise, we need
  * to leave cifs_readpages out of the address space operations.
  */
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)
 const struct address_space_operations cifs_addr_ops_smallbuf = {
+#else
+struct address_space_operations cifs_addr_ops_smallbuf = {
+#endif
 	.readpage = cifs_readpage,
 	.writepage = cifs_writepage,
 #if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 14)
Index: fs/cifs/cifsfs.h
===================================================================
--- fs/cifs/cifsfs.h	(revision 83)
+++ fs/cifs/cifsfs.h	(working copy)
@@ -41,6 +41,10 @@
 #define current_fs_time(arg) CURRENT_TIME
 #endif
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 4, 25)
+#define filemap_fdatawrite filemap_fdatasync
+#endif
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
 static inline int timespec_equal(time_t *time1, time_t *time2)
 {
@@ -61,8 +65,13 @@
 #endif
 #endif
 
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 5, 0)
 extern const struct address_space_operations cifs_addr_ops;
 extern const struct address_space_operations cifs_addr_ops_smallbuf;
+#else
+extern struct address_space_operations cifs_addr_ops;
+extern struct address_space_operations cifs_addr_ops_smallbuf;
+#endif
 
 /* Functions related to super block operations */
 extern struct super_operations cifs_super_ops;
@@ -96,11 +105,12 @@
 extern struct inode_operations cifs_file_inode_ops;
 extern struct inode_operations cifs_symlink_inode_ops;
 
+
 /* Functions related to files and directories */
-extern struct file_operations cifs_file_ops;
-extern struct file_operations cifs_file_direct_ops; /* if directio mount */
-extern struct file_operations cifs_file_nobrl_ops;
-extern struct file_operations cifs_file_direct_nobrl_ops; /* if directio mount */
+extern const struct file_operations cifs_file_ops;
+extern const struct file_operations cifs_file_direct_ops; /* if directio mount */
+extern const struct file_operations cifs_file_nobrl_ops;
+extern const struct file_operations cifs_file_direct_nobrl_ops; /* if directio mount */
 extern int cifs_open(struct inode *inode, struct file *file);
 extern int cifs_close(struct inode *inode, struct file *file);
 extern int cifs_closedir(struct inode *inode, struct file *file);
@@ -112,7 +122,7 @@
 extern int cifs_fsync(struct file *, struct dentry *, int);
 extern int cifs_flush(struct file *);
 extern int cifs_file_mmap(struct file * , struct vm_area_struct *);
-extern struct file_operations cifs_dir_ops;
+extern const struct file_operations cifs_dir_ops;
 extern int cifs_dir_open(struct inode *inode, struct file *file);
 extern int cifs_readdir(struct file *file, void *direntry, filldir_t filldir);
 extern int cifs_dir_notify(struct file *, unsigned long arg);
Index: fs/cifs/transport.c
===================================================================
--- fs/cifs/transport.c	(revision 83)
+++ fs/cifs/transport.c	(working copy)
@@ -316,7 +316,9 @@
 		if (rc >= total_len) {
 			if(rc > total_len) {
 				cERROR(1,("unexpected length received"));
+#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 4, 19)
 				dump_stack();
+#endif
 			}
 			break;
 		}
Index: fs/cifs/cifsglob.h
===================================================================
--- fs/cifs/cifsglob.h	(revision 83)
+++ fs/cifs/cifsglob.h	(working copy)
@@ -592,3 +592,22 @@
 GLOBAL_EXTERN unsigned int cifs_min_small;  /* min size of small buf pool */
 GLOBAL_EXTERN unsigned int cifs_max_pending; /* MAX requests at once to server*/
 
+extern struct inode * get_cifs_inode(struct super_block * sb);
+
+#ifndef list_for_each_entry
+#define list_for_each_entry(pos, head, member)                          \
+        for (pos = list_entry((head)->next, typeof(*pos), member),      \
+                             prefetch(pos->member.next);                        \
+                     &pos->member != (head);                                    \
+                     pos = list_entry(pos->member.next, typeof(*pos), member),  \
+                             prefetch(pos->member.next))
+#endif
+
+#ifndef list_for_each_entry_safe
+#define list_for_each_entry_safe(pos, n, head, member)                  \
+        for (pos = list_entry((head)->next, typeof(*pos), member),      \
+                         n = list_entry(pos->member.next, typeof(*pos), member); \
+                      &pos->member != (head);                                    \
+                      pos = n, n = list_entry(n->member.next, typeof(*n), member))
+#endif
+


More information about the linux-cifs-client mailing list