All of lore.kernel.org
 help / color / mirror / Atom feed
From: Olaf Kirch <okir@suse.de>
To: Trond Myklebust <trond.myklebust@fys.uio.no>
Cc: nfs@lists.sourceforge.net, Andrew Morton <akpm@osdl.org>
Subject: Re: [PATCH] NFS nolock broken in 2.6.9-rc4
Date: Fri, 15 Oct 2004 17:21:56 +0200	[thread overview]
Message-ID: <20041015152156.GH27307@suse.de> (raw)
In-Reply-To: <20041015151257.GF27307@suse.de>

[-- Attachment #1: Type: text/plain, Size: 417 bytes --]

> Urrrgh.. this looks complicated and duplicates code. Then I'd rather
> have two struct file_operations, one for normal operations with a .lock
> function, and a second one for nolock without.

Please find attached proposed fix3 that does just this.

Olaf
-- 
Olaf Kirch     | Things that make Monday morning interesting, #1:
okir@suse.de   |        "I want to use NFS over AX25, can you help me?"
---------------+ 

[-- Attachment #2: nfs-nolock-fix3 --]
[-- Type: text/plain, Size: 2034 bytes --]

Index: linux-2.6.9-rc4/fs/nfs/inode.c
===================================================================
--- linux-2.6.9-rc4.orig/fs/nfs/inode.c
+++ linux-2.6.9-rc4/fs/nfs/inode.c
@@ -666,7 +666,10 @@ nfs_fhget(struct super_block *sb, struct
 		 */
 		inode->i_op = &nfs_file_inode_operations;
 		if (S_ISREG(inode->i_mode)) {
-			inode->i_fop = &nfs_file_operations;
+			if (NFS_SERVER(inode)->flags & NFS_MOUNT_NONLM)
+				inode->i_fop = &nfs_file_operations_nolock;
+			else
+				inode->i_fop = &nfs_file_operations;
 			inode->i_data.a_ops = &nfs_file_aops;
 			inode->i_data.backing_dev_info = &NFS_SB(sb)->backing_dev_info;
 		} else if (S_ISDIR(inode->i_mode)) {
Index: linux-2.6.9-rc4/fs/nfs/file.c
===================================================================
--- linux-2.6.9-rc4.orig/fs/nfs/file.c
+++ linux-2.6.9-rc4/fs/nfs/file.c
@@ -60,6 +60,20 @@ struct file_operations nfs_file_operatio
 	.sendfile	= nfs_file_sendfile,
 	.check_flags	= nfs_check_flags,
 };
+struct file_operations nfs_file_operations_nolock = {
+	.llseek		= remote_llseek,
+	.read		= do_sync_read,
+	.write		= do_sync_write,
+	.aio_read		= nfs_file_read,
+	.aio_write		= nfs_file_write,
+	.mmap		= nfs_file_mmap,
+	.open		= nfs_file_open,
+	.flush		= nfs_file_flush,
+	.release	= nfs_file_release,
+	.fsync		= nfs_fsync,
+	.sendfile	= nfs_file_sendfile,
+	.check_flags	= nfs_check_flags,
+};
 
 struct inode_operations nfs_file_inode_operations = {
 	.permission	= nfs_permission,
Index: linux-2.6.9-rc4/include/linux/nfs_fs.h
===================================================================
--- linux-2.6.9-rc4.orig/include/linux/nfs_fs.h
+++ linux-2.6.9-rc4/include/linux/nfs_fs.h
@@ -319,6 +319,7 @@ extern u32 root_nfs_parse_addr(char *nam
  */
 extern struct inode_operations nfs_file_inode_operations;
 extern struct file_operations nfs_file_operations;
+extern struct file_operations nfs_file_operations_nolock;
 extern struct address_space_operations nfs_file_aops;
 
 static inline struct rpc_cred *nfs_file_cred(struct file *file)

  reply	other threads:[~2004-10-15 15:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-15  9:58 [PATCH] NFS nolock broken in 2.6.9-rc4 Olaf Kirch
2004-10-15 10:07 ` Olaf Kirch
2004-10-15 14:46   ` Trond Myklebust
2004-10-15 15:11     ` Trond Myklebust
2004-10-15 15:13       ` Trond Myklebust
     [not found]   ` <20041016004957.38ccd273.akpm@osdl.org>
2004-10-18  7:39     ` Olaf Kirch
2004-10-15 14:44 ` Trond Myklebust
2004-10-15 15:12   ` Olaf Kirch
2004-10-15 15:21     ` Olaf Kirch [this message]
2004-10-15 16:47       ` Trond Myklebust

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041015152156.GH27307@suse.de \
    --to=okir@suse.de \
    --cc=akpm@osdl.org \
    --cc=nfs@lists.sourceforge.net \
    --cc=trond.myklebust@fys.uio.no \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.