[ewg] [PATCH OFED-1.5] NFSRDMA: NFS backport for RHEL5.1
Jon Mason
jon at opengridcomputing.com
Thu Jun 11 14:16:06 PDT 2009
This patch provides the NFS backport for RHEL5.1. Since the RDMA
infrastructure has not been backports for this distro release, only TCP
support has been tested. It passes Connectathon as a client and server.
Signed-Off-By: Jon Mason <jon at opengridcomputing.com>
----
diff --git a/kernel_addons/backport/2.6.18-EL5.1/include/asm/bitops.h b/kernel_addons/backport/2.6.18-EL5.1/include/asm/bitops.h
new file mode 100644
index 0000000..50d5e8b
--- /dev/null
+++ b/kernel_addons/backport/2.6.18-EL5.1/include/asm/bitops.h
@@ -0,0 +1,12 @@
+#ifndef BACKPORT_ASM_BITOPS_H
+#define BACKPORT_ASM_BITOPS_H
+
+#include_next <asm/bitops.h>
+
+static inline void clear_bit_unlock(unsigned long nr, volatile unsigned long *addr)
+{
+ smp_mb__before_clear_bit();
+ clear_bit(nr, addr);
+}
+
+#endif
diff --git a/kernel_addons/backport/2.6.18-EL5.1/include/linux/cpumask.h b/kernel_addons/backport/2.6.18-EL5.1/include/linux/cpumask.h
new file mode 100644
index 0000000..f68b580
--- /dev/null
+++ b/kernel_addons/backport/2.6.18-EL5.1/include/linux/cpumask.h
@@ -0,0 +1,13 @@
+#ifndef BACKPORT_LINUX_CPUMASK_H
+#define BACKPORT_LINUX_CPUMASK_H
+
+#include_next <linux/cpumask.h>
+
+#define cpumask_of(cpu) (cpumask_of_cpu(cpu))
+#define cpumask_of_node(node) (node_to_cpumask(node))
+#define nr_node_ids (highest_possible_processor_id() + 1)
+#define nr_cpu_ids (highest_possible_processor_id() + 1)
+
+extern int set_cpus_allowed(struct task_struct *p, cpumask_t new_mask);
+
+#endif /* BACKPORT_LINUX_CPUMASK_H */
diff --git a/kernel_addons/backport/2.6.18-EL5.1/include/linux/cred.h b/kernel_addons/backport/2.6.18-EL5.1/include/linux/cred.h
new file mode 100644
index 0000000..4b8b680
--- /dev/null
+++ b/kernel_addons/backport/2.6.18-EL5.1/include/linux/cred.h
@@ -0,0 +1,11 @@
+#ifndef BACKPORT_LINUX_CRED_H
+#define BACKPORT_LINUX_CRED_H
+
+#define current_cred_xxx(xxx) \
+({ \
+ current->xxx; \
+})
+
+#define current_fsuid() (current_cred_xxx(fsuid))
+
+#endif /* BACKPORT_LINUX_CRED_H */
diff --git a/kernel_addons/backport/2.6.18-EL5.1/include/linux/dcache.h b/kernel_addons/backport/2.6.18-EL5.1/include/linux/dcache.h
new file mode 100644
index 0000000..4a571af
--- /dev/null
+++ b/kernel_addons/backport/2.6.18-EL5.1/include/linux/dcache.h
@@ -0,0 +1,22 @@
+#ifndef BACKPORT_LINUX_DCACHE_H
+#define BACKPORT_LINUX_DCACHE_H
+
+#include_next <linux/dcache.h>
+#include <linux/err.h>
+
+extern void iput(struct inode *);
+
+static inline struct dentry *d_obtain_alias(struct inode *inode)
+{
+ struct dentry *rc;
+
+ rc = d_alloc_anon(inode);
+ if (!rc) {
+ iput(inode);
+ return ERR_PTR(-ENOMEM);
+ }
+
+ return rc;
+}
+
+#endif
diff --git a/kernel_addons/backport/2.6.18-EL5.1/include/linux/device.h b/kernel_addons/backport/2.6.18-EL5.1/include/linux/device.h
new file mode 100644
index 0000000..c173074
--- /dev/null
+++ b/kernel_addons/backport/2.6.18-EL5.1/include/linux/device.h
@@ -0,0 +1,11 @@
+#ifndef __BACKPORT_LINUX_DEVICE_H_TO_2_6_25__
+#define __BACKPORT_LINUX_DEVICE_H_TO_2_6_25__
+
+#include_next <linux/device.h>
+
+static inline const char *dev_name(const struct device *dev)
+{
+ return dev->bus_id;
+}
+
+#endif /* __BACKPORT_LINUX_DEVICE_H_TO_2_6_25__ */
diff --git a/kernel_addons/backport/2.6.18-EL5.1/include/linux/freezer.h b/kernel_addons/backport/2.6.18-EL5.1/include/linux/freezer.h
index fe2a379..d52d975 100644
--- a/kernel_addons/backport/2.6.18-EL5.1/include/linux/freezer.h
+++ b/kernel_addons/backport/2.6.18-EL5.1/include/linux/freezer.h
@@ -1,18 +1,5 @@
#ifndef BACKPORT_LINUX_FREEZER_H
#define BACKPORT_LINUX_FREEZER_H
-/*
-static inline int frozen(struct task_struct *p) { return 0; }
-static inline int freezing(struct task_struct *p) { return 0; }
-static inline void freeze(struct task_struct *p) { BUG(); }
-static inline int thaw_process(struct task_struct *p) { return 1; }
-static inline void frozen_process(struct task_struct *p) { BUG(); }
-
-static inline void refrigerator(void) {}
-static inline int freeze_processes(void) { BUG(); return 0; }
-static inline void thaw_processes(void) {}
-
-static inline int try_to_freeze(void) { return 0; }
-*/
static inline void set_freezable(void) {}
diff --git a/kernel_addons/backport/2.6.18-EL5.1/include/linux/fs.h b/kernel_addons/backport/2.6.18-EL5.1/include/linux/fs.h
index 00ac858..a6d81fb 100644
--- a/kernel_addons/backport/2.6.18-EL5.1/include/linux/fs.h
+++ b/kernel_addons/backport/2.6.18-EL5.1/include/linux/fs.h
@@ -2,30 +2,82 @@
#define BACKPORT_LINUX_FS_H
#include_next <linux/fs.h>
+#include <linux/sched.h>
+#include <linux/fs_struct.h>
#include <linux/mount.h>
-#define FILE_LOCK_DEFERRED -EINPROGRESS
-#define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move()
- * during rename() internally.
- */
+#define ATTR_KILL_PRIV (1 << 14)
+#define FILE_LOCK_DEFERRED -EINPROGRESS
+#define FS_RENAME_DOES_D_MOVE 32768
+#define __locks_copy_lock locks_copy_lock
+#define mandatory_lock(_args) (MANDATORY_LOCK(_args))
+#define vfs_setlease(a, b, c) (setlease(a, b, c))
-#define ATTR_KILL_PRIV (1 << 14)
+struct lock_manager {
+ struct list_head list;
+};
-#define vfs_setlease(a, b, c) setlease(a, b, c)
+void locks_start_grace(struct lock_manager *);
+void locks_end_grace(struct lock_manager *);
+int locks_in_grace(void);
-static inline int __mandatory_lock(struct inode *ino)
+static inline bool execute_ok(struct inode *inode)
{
- return (ino->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID;
+ return (inode->i_mode & S_IXUGO) || S_ISDIR(inode->i_mode);
+}
+
+static inline int current_umask(void)
+{
+ return current->fs->umask;
+}
+
+static inline void free_fs_struct(struct fs_struct *fs)
+{
+ struct task_struct *tsk;
+
+ tsk = kzalloc(sizeof(struct task_struct), GFP_KERNEL);
+ if (!tsk)
+ return;
+
+ spin_lock_init(&tsk->alloc_lock);
+ tsk->fs = fs;
+
+ exit_fs(tsk);
+ kfree(tsk);
}
-#define mandatory_lock(_args) MANDATORY_LOCK(_args)
+static inline int unshare_fs_struct(void)
+{
+ struct fs_struct *fs = current->fs;
+ struct fs_struct *new_fs = copy_fs_struct(fs);
+ int kill;
+
+ if (!new_fs)
+ return -ENOMEM;
+
+ task_lock(current);
+ write_lock(&fs->lock);
+ kill = atomic_read(&fs->count) == 1;
+ current->fs = new_fs;
+ write_unlock(&fs->lock);
+ task_unlock(current);
+
+ if (kill)
+ free_fs_struct(fs);
+
+ return 0;
+}
+
+static inline int inode_permission(struct inode *inode, int flags)
+{
+ return permission(inode, flags, NULL);
+}
static inline int backport_vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname)
{
return vfs_symlink(dir, dentry, oldname, 0);
}
-
#define vfs_symlink(_dir, _dentry, _oldname) backport_vfs_symlink(_dir, _dentry, _oldname)
#ifdef CONFIG_DEBUG_WRITECOUNT
@@ -38,11 +90,6 @@ static inline void file_take_write(struct file *f)
static inline void file_take_write(struct file *filp) {}
#endif
-static inline int inode_permission(struct inode *inode, int flags)
-{
- return permission(inode, flags, NULL);
-}
-
static inline int __mnt_is_readonly(struct vfsmount *mnt)
{
if (mnt->mnt_sb->s_flags & MS_RDONLY)
@@ -50,6 +97,11 @@ static inline int __mnt_is_readonly(struct vfsmount *mnt)
return 0;
}
+static inline int __mandatory_lock(struct inode *ino)
+{
+ return (ino->i_mode & (S_ISGID | S_IXGRP)) == S_ISGID;
+}
+
static inline void drop_nlink(struct inode *inode)
{
inode->i_nlink--;
@@ -62,9 +114,13 @@ static inline void clear_nlink(struct inode *inode)
static inline int vfs_test_lock(struct file *filp, struct file_lock *fl)
{
+ int rc;
+
if (filp->f_op && filp->f_op->lock)
return filp->f_op->lock(filp, F_GETLK, fl);
- posix_test_lock(filp, fl, fl);
+ rc = posix_test_lock(filp, fl, fl);
+ if (rc == 0)
+ fl->fl_type = F_UNLCK;
return 0;
}
diff --git a/kernel_addons/backport/2.6.18-EL5.1/include/linux/fscache.h b/kernel_addons/backport/2.6.18-EL5.1/include/linux/fscache.h
new file mode 100644
index 0000000..2bf84b6
--- /dev/null
+++ b/kernel_addons/backport/2.6.18-EL5.1/include/linux/fscache.h
@@ -0,0 +1,50 @@
+#ifndef BACKPORT_LINUX_FSCACHE_H
+#define BACKPORT_LINUX_FSCACHE_H
+
+#include_next <linux/fscache.h>
+#include <linux/page-flags.h>
+
+#define NFS_PAGE_WRITING 0
+#define NFS_PAGE_CACHED 1
+
+#define PageNfsBit(bit, page) test_bit(bit, &(page)->private)
+
+#define SetPageNfsBit(bit, page) \
+do { \
+ SetPagePrivate((page)); \
+ set_bit(bit, &(page)->private); \
+} while(0)
+
+#define ClearPageNfsBit(bit, page) \
+do { \
+ clear_bit(bit, &(page)->private); \
+} while(0)
+
+#define PageNfsWriting(page) PageNfsBit(NFS_PAGE_WRITING, (page))
+#define SetPageNfsWriting(page) SetPageNfsBit(NFS_PAGE_WRITING, (page))
+#define ClearPageNfsWriting(page) ClearPageNfsBit(NFS_PAGE_WRITING, (page))
+
+#define PageNfsCached(page) PageNfsBit(NFS_PAGE_CACHED, (page))
+#define SetPageNfsCached(page) SetPageNfsBit(NFS_PAGE_CACHED, (page))
+#define ClearPageNfsCached(page) ClearPageNfsBit(NFS_PAGE_CACHED, (page))
+
+
+#define PageFsCache(page) PageNfsCached(page)
+#define ClearPageFsCache(page) ClearPageNfsCached(page)
+#define fscache_check_page_write(cookie, page) PageNfsWriting(page)
+
+static inline void
+fscache_wait_on_page_write(struct fscache_cookie *cookie, struct page *page)
+{
+ wait_queue_head_t *wq = bit_waitqueue(&(page)->private, 0);
+ wait_event(*wq, !PageNfsWriting(page));
+}
+
+static inline int
+backport_fscache_write_page(struct fscache_cookie *cookie, struct page *page, gfp_t gfp)
+{
+ return fscache_write_page(cookie, page, NULL, NULL, gfp);
+}
+#define fscache_write_page backport_fscache_write_page
+
+#endif
diff --git a/kernel_addons/backport/2.6.18-EL5.1/include/linux/in6.h b/kernel_addons/backport/2.6.18-EL5.1/include/linux/in6.h
new file mode 100644
index 0000000..be983f2
--- /dev/null
+++ b/kernel_addons/backport/2.6.18-EL5.1/include/linux/in6.h
@@ -0,0 +1,8 @@
+#ifndef BACKPORT_LINUX_IN6_H
+#define BACKPORT_LINUX_IN6_H
+
+#include_next <linux/in6.h>
+
+#define IN6ADDR_ANY_INIT { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } }
+
+#endif
diff --git a/kernel_addons/backport/2.6.18-EL5.1/include/linux/jiffies.h b/kernel_addons/backport/2.6.18-EL5.1/include/linux/jiffies.h
index ccfd69f..3c48bb6 100644
--- a/kernel_addons/backport/2.6.18-EL5.1/include/linux/jiffies.h
+++ b/kernel_addons/backport/2.6.18-EL5.1/include/linux/jiffies.h
@@ -1,10 +1,10 @@
-#ifndef _JIFFIES_BACKPORT_H
-#define _JIFFIES_BACKPORT_H
+#ifndef BACKPORT_LINUX_JIFFIES_H
+#define BACKPORT_LINUX_JIFFIES_H
#include_next <linux/jiffies.h>
-#define time_in_range(a,b,c) \
+#define time_in_range_open(a,b,c) \
(time_after_eq(a,b) && \
- time_before_eq(a,c))
+ time_before(a,c))
-#endif /* _JIFFIES_BACKPORT_H */
+#endif /* BACKPORT_LINUX_JIFFIES_H */
diff --git a/kernel_addons/backport/2.6.18-EL5.1/include/linux/magic.h b/kernel_addons/backport/2.6.18-EL5.1/include/linux/magic.h
index 5470e48..2793ee8 100644
--- a/kernel_addons/backport/2.6.18-EL5.1/include/linux/magic.h
+++ b/kernel_addons/backport/2.6.18-EL5.1/include/linux/magic.h
@@ -2,5 +2,6 @@
#define BACKPORT_LINUX_MAGIC_H
#define NFS_SUPER_MAGIC 0x6969
+#define MSDOS_SUPER_MAGIC 0x4d44
#endif
diff --git a/kernel_addons/backport/2.6.18-EL5.1/include/linux/mm.h b/kernel_addons/backport/2.6.18-EL5.1/include/linux/mm.h
index 18fe1e2..54b1891 100644
--- a/kernel_addons/backport/2.6.18-EL5.1/include/linux/mm.h
+++ b/kernel_addons/backport/2.6.18-EL5.1/include/linux/mm.h
@@ -8,6 +8,7 @@
#include <asm/highmem.h>
#endif
+#define VM_FAULT_LOCKED 0x0200 /* ->fault locked the returned page */
#define VM_CAN_NONLINEAR 0x08000000 /* Has ->fault & does nonlinear pages */
#define is_vmalloc_addr(x) ((unsigned long)(x) >= VMALLOC_START && (unsigned long)(x) < VMALLOC_END)
diff --git a/kernel_addons/backport/2.6.18-EL5.1/include/linux/mnt_namespace.h b/kernel_addons/backport/2.6.18-EL5.1/include/linux/mnt_namespace.h
new file mode 100644
index 0000000..59c8502
--- /dev/null
+++ b/kernel_addons/backport/2.6.18-EL5.1/include/linux/mnt_namespace.h
@@ -0,0 +1,4 @@
+#ifndef BACKPORT_LINUX_MNT_NAMESPACE_H
+#define BACKPORT_LINUX_MNT_NAMESPACE_H
+
+#endif
diff --git a/kernel_addons/backport/2.6.18-EL5.1/include/linux/mutex.h b/kernel_addons/backport/2.6.18-EL5.1/include/linux/mutex.h
new file mode 100644
index 0000000..553d487
--- /dev/null
+++ b/kernel_addons/backport/2.6.18-EL5.1/include/linux/mutex.h
@@ -0,0 +1,8 @@
+#ifndef LINUX_MUTEX_BACKPORT_H
+#define LINUX_MUTEX_BACKPORT_H
+
+#include_next <linux/mutex.h>
+
+#define mutex_lock_killable(lock) mutex_lock_interruptible(lock)
+
+#endif
diff --git a/kernel_addons/backport/2.6.18-EL5.1/include/linux/namei.h b/kernel_addons/backport/2.6.18-EL5.1/include/linux/namei.h
index 347948c..77de824 100644
--- a/kernel_addons/backport/2.6.18-EL5.1/include/linux/namei.h
+++ b/kernel_addons/backport/2.6.18-EL5.1/include/linux/namei.h
@@ -2,7 +2,26 @@
#define BACKPORT_LINUX_NAMEI_H
#include_next <linux/namei.h>
-#include <linux/mount.h>
+
+#define LOOKUP_EXCL 0x0400
+
+struct path {
+ struct vfsmount *mnt;
+ struct dentry *dentry;
+};
+
+#include <linux/path.h>
+
+static inline int kern_path(const char *name, unsigned int flags, struct path *path)
+{
+ struct nameidata nd;
+ int rc = path_lookup(name, flags, &nd);
+ if (!rc) {
+ (*path).mnt = nd.mnt;
+ (*path).dentry = nd.dentry;
+ }
+ return rc;
+}
static inline int vfs_path_lookup(struct dentry *dentry, struct vfsmount *mnt,
const char *name, unsigned int flags,
@@ -24,4 +43,5 @@ static inline int vfs_path_lookup(struct dentry *dentry, struct vfsmount *mnt,
return retval;
}
+
#endif /* BACKPORT_LINUX_NAMEI_H */
diff --git a/kernel_addons/backport/2.6.18-EL5.1/include/linux/pagevec.h b/kernel_addons/backport/2.6.18-EL5.1/include/linux/pagevec.h
new file mode 100644
index 0000000..1fb684d
--- /dev/null
+++ b/kernel_addons/backport/2.6.18-EL5.1/include/linux/pagevec.h
@@ -0,0 +1,17 @@
+#ifndef BACKPORT_LINUX_PAGEVEC_H
+#define BACKPORT_LINUX_PAGEVEC_H
+
+#include_next <linux/pagevec.h>
+
+static inline void __pagevec_lru_add_file(struct pagevec *pvec)
+{
+ __pagevec_lru_add(pvec);
+}
+
+static inline void pagevec_lru_add_file(struct pagevec *pvec)
+{
+ if (pagevec_count(pvec))
+ __pagevec_lru_add_file(pvec);
+}
+
+#endif
diff --git a/kernel_addons/backport/2.6.18-EL5.1/include/linux/path.h b/kernel_addons/backport/2.6.18-EL5.1/include/linux/path.h
index d13c8c8..a261eb0 100644
--- a/kernel_addons/backport/2.6.18-EL5.1/include/linux/path.h
+++ b/kernel_addons/backport/2.6.18-EL5.1/include/linux/path.h
@@ -4,11 +4,6 @@
#include <linux/mount.h>
#include <linux/namei.h>
-struct path {
- struct vfsmount *mnt;
- struct dentry *dentry;
-};
-
static inline void path_put(struct path *path)
{
dput(path->dentry);
diff --git a/kernel_addons/backport/2.6.18-EL5.1/include/linux/quotaops.h b/kernel_addons/backport/2.6.18-EL5.1/include/linux/quotaops.h
new file mode 100644
index 0000000..0a87ccd
--- /dev/null
+++ b/kernel_addons/backport/2.6.18-EL5.1/include/linux/quotaops.h
@@ -0,0 +1,70 @@
+#ifndef BACKPORT_LINUX_QUOTAOPS_H
+#define BACKPORT_LINUX_QUOTAOPS_H
+
+#include_next <linux/quotaops.h>
+
+/* Quota state flags - they actually come in two flavors - for users and groups */
+enum {
+ _DQUOT_USAGE_ENABLED = 0, /* Track disk usage for users */
+ _DQUOT_LIMITS_ENABLED, /* Enforce quota limits for users */
+ _DQUOT_SUSPENDED, /* User diskquotas are off, but
+ * we have necessary info in
+ * memory to turn them on */
+ _DQUOT_STATE_FLAGS
+};
+
+#define DQUOT_USAGE_ENABLED (1 << _DQUOT_USAGE_ENABLED)
+#define DQUOT_LIMITS_ENABLED (1 << _DQUOT_LIMITS_ENABLED)
+#define DQUOT_SUSPENDED (1 << _DQUOT_SUSPENDED)
+
+static inline unsigned int dquot_state_flag(unsigned int flags, int type)
+{
+ if (type == USRQUOTA)
+ return flags;
+ return flags << _DQUOT_STATE_FLAGS;
+}
+
+static inline int sb_has_quota_usage_enabled(struct super_block *sb, int type)
+{
+ return sb_dqopt(sb)->flags &
+ dquot_state_flag(DQUOT_USAGE_ENABLED, type);
+}
+
+static inline int sb_has_quota_limits_enabled(struct super_block *sb, int type)
+{
+ return sb_dqopt(sb)->flags &
+ dquot_state_flag(DQUOT_LIMITS_ENABLED, type);
+}
+
+static inline int sb_has_quota_suspended(struct super_block *sb, int type)
+{
+ return sb_dqopt(sb)->flags &
+ dquot_state_flag(DQUOT_SUSPENDED, type);
+}
+
+static inline int sb_has_quota_loaded(struct super_block *sb, int type)
+{
+ /* Currently if anything is on, then quota usage is on as well */
+ return sb_has_quota_usage_enabled(sb, type);
+}
+
+static inline int sb_has_quota_active(struct super_block *sb, int type)
+{
+ return sb_has_quota_loaded(sb, type) &&
+ !sb_has_quota_suspended(sb, type);
+}
+
+static inline int sb_any_quota_active(struct super_block *sb)
+{
+ return sb_has_quota_active(sb, USRQUOTA) ||
+ sb_has_quota_active(sb, GRPQUOTA);
+}
+
+static inline void vfs_dq_init(struct inode *inode)
+{
+ BUG_ON(!inode->i_sb);
+ if (sb_any_quota_active(inode->i_sb) && !IS_NOQUOTA(inode))
+ inode->i_sb->dq_op->initialize(inode, -1);
+}
+
+#endif /* BACKPORT_LINUX_QUOTAOPS_H */
diff --git a/kernel_addons/backport/2.6.18-EL5.1/include/linux/sched.h b/kernel_addons/backport/2.6.18-EL5.1/include/linux/sched.h
index 926e520..b87dc73 100644
--- a/kernel_addons/backport/2.6.18-EL5.1/include/linux/sched.h
+++ b/kernel_addons/backport/2.6.18-EL5.1/include/linux/sched.h
@@ -23,4 +23,12 @@ static inline pid_t task_pid_nr(struct task_struct *tsk)
{
return tsk->pid;
}
+
+static inline int
+backport_set_cpus_allowed_ptr(struct task_struct *p, const cpumask_t new_mask)
+{
+ return set_cpus_allowed(p, new_mask);
+}
+#define set_cpus_allowed_ptr backport_set_cpus_allowed_ptr
+
#endif
diff --git a/kernel_addons/backport/2.6.18-EL5.1/include/linux/splice.h b/kernel_addons/backport/2.6.18-EL5.1/include/linux/splice.h
new file mode 100644
index 0000000..7c133b5
--- /dev/null
+++ b/kernel_addons/backport/2.6.18-EL5.1/include/linux/splice.h
@@ -0,0 +1,4 @@
+#ifndef BACKPORT_LINUX_SPLICE_H
+#define BACKPORT_LINUX_SPLICE_H
+
+#endif /* BACKPORT_LINUX_SPLICE_H */
diff --git a/kernel_addons/backport/2.6.18-EL5.1/include/linux/types.h b/kernel_addons/backport/2.6.18-EL5.1/include/linux/types.h
index fd8e25a..c16779d 100644
--- a/kernel_addons/backport/2.6.18-EL5.1/include/linux/types.h
+++ b/kernel_addons/backport/2.6.18-EL5.1/include/linux/types.h
@@ -6,5 +6,6 @@
typedef _Bool bool;
typedef __u16 __sum16;
typedef __u32 __wsum;
+typedef unsigned __bitwise__ fmode_t;
#endif
diff --git a/kernel_addons/backport/2.6.18-EL5.1/include/linux/workqueue.h b/kernel_addons/backport/2.6.18-EL5.1/include/linux/workqueue.h
index f1428c9..ed4032f 100644
--- a/kernel_addons/backport/2.6.18-EL5.1/include/linux/workqueue.h
+++ b/kernel_addons/backport/2.6.18-EL5.1/include/linux/workqueue.h
@@ -69,4 +69,9 @@ static inline void backport_cancel_rearming_delayed_work(struct delayed_work *wo
#define cancel_rearming_delayed_work backport_cancel_rearming_delayed_work
+static inline struct delayed_work *to_delayed_work(struct work_struct *work)
+{
+ return container_of(work, struct delayed_work, work);
+}
+
#endif
diff --git a/kernel_addons/backport/2.6.18-EL5.1/include/net/ipv6.h b/kernel_addons/backport/2.6.18-EL5.1/include/net/ipv6.h
index 1849c72..e506945 100644
--- a/kernel_addons/backport/2.6.18-EL5.1/include/net/ipv6.h
+++ b/kernel_addons/backport/2.6.18-EL5.1/include/net/ipv6.h
@@ -1,16 +1,10 @@
-#ifndef __BACKPORT_NET_IVP6_H
-#define __BACKPORT_NET_IVP6_H
+#ifndef BACKPORT_NET_IPV6_H
+#define BACKPORT_NET_IPV6_H
#include_next <net/ipv6.h>
-static inline int ipv6_addr_v4mapped(const struct in6_addr *a)
-{
- return ((a->s6_addr32[0] | a->s6_addr32[1] |
- (a->s6_addr32[2] ^ htonl(0x0000ffff))) == 0);
-}
-
static inline void ipv6_addr_set_v4mapped(const __be32 addr,
- struct in6_addr *v4mapped)
+ struct in6_addr *v4mapped)
{
ipv6_addr_set(v4mapped,
0, 0,
@@ -18,4 +12,16 @@ static inline void ipv6_addr_set_v4mapped(const __be32 addr,
addr);
}
-#endif /* __BACKPORT_NET_IVP6_H */
+static inline int ipv6_addr_v4mapped(const struct in6_addr *a)
+{
+ return ((a->s6_addr32[0] | a->s6_addr32[1] |
+ (a->s6_addr32[2] ^ htonl(0x0000ffff))) == 0);
+}
+
+static inline int ipv6_addr_loopback(const struct in6_addr *a)
+{
+ return ((a->s6_addr32[0] | a->s6_addr32[1] |
+ a->s6_addr32[2] | (a->s6_addr32[3] ^ htonl(1))) == 0);
+}
+
+#endif
diff --git a/kernel_patches/backport/2.6.18-EL5.1/rnfs_fs.patch b/kernel_patches/backport/2.6.18-EL5.1/rnfs_fs.patch
index a7687ad..5ca5f99 100644
--- a/kernel_patches/backport/2.6.18-EL5.1/rnfs_fs.patch
+++ b/kernel_patches/backport/2.6.18-EL5.1/rnfs_fs.patch
@@ -1,63 +1,33 @@
-diff --git a/drivers/infiniband/core/Makefile b/drivers/infiniband/core/Makefile
-index 03acfd6..992e4aa 100644
---- a/drivers/infiniband/core/Makefile
-+++ b/drivers/infiniband/core/Makefile
-@@ -31,4 +31,4 @@ ib_ucm-y := ucm.o
-
- ib_uverbs-y := uverbs_main.o uverbs_cmd.o uverbs_marshall.o
-
--ib_core-y += genalloc.o
-+ib_core-y += genalloc.o namespace.o writeback.o
-diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
-index 8ea4d01..5d49041 100644
---- a/drivers/infiniband/core/device.c
-+++ b/drivers/infiniband/core/device.c
-@@ -39,7 +39,7 @@
- #include <linux/init.h>
- #include <linux/mutex.h>
- #include <linux/workqueue.h>
--
-+#include <linux/mount.h>
- #include "core_priv.h"
-
- MODULE_AUTHOR("Roland Dreier");
-@@ -735,6 +735,10 @@ static int __init ib_core_init(void)
- dma_map_sg_hp_wa = 1;
- #endif
-
-+ ret = init_mnt_writers();
-+ if (ret)
-+ printk(KERN_WARNING "Couldn't init mnt_writers\n");
-+
- ret = ib_sysfs_setup();
- if (ret)
- printk(KERN_WARNING "Couldn't create InfiniBand device class\n");
-diff --git a/drivers/infiniband/core/namespace.c b/drivers/infiniband/core/namespace.c
-new file mode 100644
-index 0000000..de57f8b
---- /dev/null
-+++ b/drivers/infiniband/core/namespace.c
-@@ -0,0 +1 @@
-+#include "src/namespace.c"
-diff --git a/drivers/infiniband/core/writeback.c b/drivers/infiniband/core/writeback.c
-new file mode 100644
-index 0000000..b838ead
---- /dev/null
-+++ b/drivers/infiniband/core/writeback.c
-@@ -0,0 +1 @@
-+#include "src/writeback.c"
diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c
-index cc91227..262397b 100644
+index 197c7db..027f947 100644
--- a/fs/exportfs/expfs.c
+++ b/fs/exportfs/expfs.c
-@@ -361,11 +361,14 @@ struct dentry *exportfs_decode_fh(struct vfsmount *mnt, struct fid *fid,
- const struct export_operations *nop = mnt->mnt_sb->s_export_op;
+@@ -250,7 +250,6 @@ static int filldir_one(void * __buf, const char * name, int len,
+ static int get_name(struct vfsmount *mnt, struct dentry *dentry,
+ char *name, struct dentry *child)
+ {
+- const struct cred *cred = current_cred();
+ struct inode *dir = dentry->d_inode;
+ int error;
+ struct file *file;
+@@ -265,7 +264,7 @@ static int get_name(struct vfsmount *mnt, struct dentry *dentry,
+ /*
+ * Open the directory ...
+ */
+- file = dentry_open(dget(dentry), mntget(mnt), O_RDONLY, cred);
++ file = dentry_open(dget(dentry), mntget(mnt), O_RDONLY);
+ error = PTR_ERR(file);
+ if (IS_ERR(file))
+ goto out;
+@@ -364,11 +363,15 @@ struct dentry *exportfs_decode_fh(struct vfsmount *mnt, struct fid *fid,
struct dentry *result, *alias;
+ char nbuf[NAME_MAX+1];
int err;
+ __u32 objp[2];
-
++
+ objp[0] = fid->i32.ino;
+ objp[1] = fid->i32.gen;
+
/*
* Try to get any dentry for the given file handle from the filesystem.
*/
@@ -66,7 +36,7 @@ index cc91227..262397b 100644
if (!result)
result = ERR_PTR(-ESTALE);
if (IS_ERR(result))
-@@ -417,11 +420,10 @@ struct dentry *exportfs_decode_fh(struct vfsmount *mnt, struct fid *fid,
+@@ -419,11 +422,10 @@ struct dentry *exportfs_decode_fh(struct vfsmount *mnt, struct fid *fid,
* file handle. If this fails we'll have to give up.
*/
err = -ESTALE;
@@ -81,12 +51,12 @@ index cc91227..262397b 100644
goto err_result;
err = PTR_ERR(target_dir);
diff --git a/fs/lockd/clntlock.c b/fs/lockd/clntlock.c
-index 0b45fd3..2c45814 100644
+index 1f3b0fc..6c55555 100644
--- a/fs/lockd/clntlock.c
+++ b/fs/lockd/clntlock.c
-@@ -168,7 +168,7 @@ __be32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *lock
+@@ -168,7 +168,7 @@ __be32 nlmclnt_grant(const struct sockaddr *addr, const struct nlm_lock *lock)
continue;
- if (!nlm_cmp_addr(&block->b_host->h_addr, addr))
+ if (!nlm_cmp_addr(nlm_addr(block->b_host), addr))
continue;
- if (nfs_compare_fh(NFS_FH(fl_blocked->fl_file->f_path.dentry->d_inode) ,fh) != 0)
+ if (nfs_compare_fh(NFS_FH(fl_blocked->fl_file->f_dentry->d_inode), fh) != 0)
@@ -94,10 +64,10 @@ index 0b45fd3..2c45814 100644
/* Alright, we found a lock. Set the return status
* and wake up the caller
diff --git a/fs/lockd/clntproc.c b/fs/lockd/clntproc.c
-index 31668b6..8c72d30 100644
+index dd79570..6e2063a 100644
--- a/fs/lockd/clntproc.c
+++ b/fs/lockd/clntproc.c
-@@ -128,12 +128,12 @@ static void nlmclnt_setlockargs(struct nlm_rqst *req, struct file_lock *fl)
+@@ -127,12 +127,12 @@ static void nlmclnt_setlockargs(struct nlm_rqst *req, struct file_lock *fl)
nlmclnt_next_cookie(&argp->cookie);
argp->state = nsm_local_state;
@@ -114,20 +84,45 @@ index 31668b6..8c72d30 100644
lock->fl.fl_start = fl->fl_start;
lock->fl.fl_end = fl->fl_end;
diff --git a/fs/lockd/mon.c b/fs/lockd/mon.c
-index e4d5635..771edc1 100644
+index 6d5d4a4..1831d8e 100644
--- a/fs/lockd/mon.c
+++ b/fs/lockd/mon.c
-@@ -194,7 +194,7 @@ static __be32 *xdr_encode_mon_name(__be32 *p, struct nsm_args *argp)
- */
- static __be32 *xdr_encode_my_id(__be32 *p, struct nsm_args *argp)
+@@ -65,7 +65,7 @@ static void nsm_display_ipv4_address(const struct sockaddr *sap, char *buf,
+ const size_t len)
{
-- p = xdr_encode_nsm_string(p, utsname()->nodename);
-+ p = xdr_encode_nsm_string(p, system_utsname.nodename);
- if (!p)
- return ERR_PTR(-EIO);
+ const struct sockaddr_in *sin = (struct sockaddr_in *)sap;
+- snprintf(buf, len, "%pI4", &sin->sin_addr.s_addr);
++ snprintf(buf, len, NIPQUAD_FMT, NIPQUAD(sin->sin_addr.s_addr));
+ }
+
+ static void nsm_display_ipv6_address(const struct sockaddr *sap, char *buf,
+@@ -74,12 +74,11 @@ static void nsm_display_ipv6_address(const struct sockaddr *sap, char *buf,
+ const struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sap;
+
+ if (ipv6_addr_v4mapped(&sin6->sin6_addr))
+- snprintf(buf, len, "%pI4", &sin6->sin6_addr.s6_addr32[3]);
++ snprintf(buf, len, NIPQUAD_FMT, NIPQUAD(sin6->sin6_addr.s6_addr32[3]));
+ else if (sin6->sin6_scope_id != 0)
+- snprintf(buf, len, "%pI6%%%u", &sin6->sin6_addr,
+- sin6->sin6_scope_id);
++ snprintf(buf, len, NIP6_FMT"%%%u", NIP6(sin6->sin6_addr), sin6->sin6_scope_id);
+ else
+- snprintf(buf, len, "%pI6", &sin6->sin6_addr);
++ snprintf(buf, len, NIP6_FMT, NIP6(sin6->sin6_addr));
+ }
+
+ static void nsm_display_address(const struct sockaddr *sap,
+@@ -465,7 +464,7 @@ static int encode_my_id(struct xdr_stream *xdr, const struct nsm_args *argp)
+ int status;
+ __be32 *p;
+- status = encode_nsm_string(xdr, utsname()->nodename);
++ status = encode_nsm_string(xdr, system_utsname.nodename);
+ if (unlikely(status != 0))
+ return status;
+ p = xdr_reserve_space(xdr, 3 * sizeof(u32));
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c
-index cf0d5c2..2e6ec1b 100644
+index 83ee342..bb43301 100644
--- a/fs/lockd/svclock.c
+++ b/fs/lockd/svclock.c
@@ -304,7 +304,7 @@ static int nlmsvc_setgrantargs(struct nlm_rqst *call, struct nlm_lock *lock)
@@ -150,38 +145,7 @@ index cf0d5c2..2e6ec1b 100644
lock->fl.fl_type, lock->fl.fl_pid,
(long long)lock->fl.fl_start,
(long long)lock->fl.fl_end,
-@@ -417,11 +417,18 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file,
- ret = nlm_granted;
- goto out;
- case -EAGAIN:
-- ret = nlm_lck_denied;
-- goto out;
-+ if (wait) {
-+ ret = nlm_lck_blocked;
-+ break;
-+ } else {
-+ ret = nlm_lck_denied;
-+ goto out;
-+ }
- case FILE_LOCK_DEFERRED:
-- if (wait)
-+ if (wait) {
-+ ret = nlm_lck_blocked;
- break;
-+ }
- /* Filesystem lock operation is in progress
- Add it to the queue waiting for callback */
- ret = nlmsvc_defer_lock_rqst(rqstp, block);
-@@ -434,8 +441,6 @@ nlmsvc_lock(struct svc_rqst *rqstp, struct nlm_file *file,
- goto out;
- }
-
-- ret = nlm_lck_blocked;
--
- /* Append to list of blocked */
- nlmsvc_insert_block(block, NLM_NEVER);
- out:
-@@ -458,8 +463,8 @@ nlmsvc_testlock(struct svc_rqst *rqstp, struct nlm_file *file,
+@@ -474,8 +474,8 @@ nlmsvc_testlock(struct svc_rqst *rqstp, struct nlm_file *file,
__be32 ret;
dprintk("lockd: nlmsvc_testlock(%s/%ld, ty=%d, %Ld-%Ld)\n",
@@ -192,7 +156,7 @@ index cf0d5c2..2e6ec1b 100644
lock->fl.fl_type,
(long long)lock->fl.fl_start,
(long long)lock->fl.fl_end);
-@@ -547,8 +552,8 @@ nlmsvc_unlock(struct nlm_file *file, struct nlm_lock *lock)
+@@ -567,8 +567,8 @@ nlmsvc_unlock(struct nlm_file *file, struct nlm_lock *lock)
int error;
dprintk("lockd: nlmsvc_unlock(%s/%ld, pi=%d, %Ld-%Ld)\n",
@@ -203,7 +167,7 @@ index cf0d5c2..2e6ec1b 100644
lock->fl.fl_pid,
(long long)lock->fl.fl_start,
(long long)lock->fl.fl_end);
-@@ -576,8 +581,8 @@ nlmsvc_cancel_blocked(struct nlm_file *file, struct nlm_lock *lock)
+@@ -596,8 +596,8 @@ nlmsvc_cancel_blocked(struct nlm_file *file, struct nlm_lock *lock)
int status = 0;
dprintk("lockd: nlmsvc_cancel(%s/%ld, pi=%d, %Ld-%Ld)\n",
@@ -214,7 +178,7 @@ index cf0d5c2..2e6ec1b 100644
lock->fl.fl_pid,
(long long)lock->fl.fl_start,
(long long)lock->fl.fl_end);
-@@ -595,63 +600,6 @@ nlmsvc_cancel_blocked(struct nlm_file *file, struct nlm_lock *lock)
+@@ -618,63 +618,6 @@ nlmsvc_cancel_blocked(struct nlm_file *file, struct nlm_lock *lock)
}
/*
@@ -278,7 +242,7 @@ index cf0d5c2..2e6ec1b 100644
* Unblock a blocked lock request. This is a callback invoked from the
* VFS layer when a lock on which we blocked is removed.
*
-@@ -683,7 +631,6 @@ static int nlmsvc_same_owner(struct file_lock *fl1, struct file_lock *fl2)
+@@ -706,7 +649,6 @@ static int nlmsvc_same_owner(struct file_lock *fl1, struct file_lock *fl2)
struct lock_manager_operations nlmsvc_lock_operations = {
.fl_compare_owner = nlmsvc_same_owner,
.fl_notify = nlmsvc_notify_blocked,
@@ -287,10 +251,10 @@ index cf0d5c2..2e6ec1b 100644
/*
diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c
-index 198b4e5..2109091 100644
+index 9e4d6aa..40884ca 100644
--- a/fs/lockd/svcsubs.c
+++ b/fs/lockd/svcsubs.c
-@@ -45,7 +45,7 @@ static inline void nlm_debug_print_fh(char *msg, struct nfs_fh *f)
+@@ -44,7 +44,7 @@ static inline void nlm_debug_print_fh(char *msg, struct nfs_fh *f)
static inline void nlm_debug_print_file(char *msg, struct nlm_file *file)
{
@@ -299,7 +263,7 @@ index 198b4e5..2109091 100644
dprintk("lockd: %s %s/%ld\n",
msg, inode->i_sb->s_id, inode->i_ino);
-@@ -396,7 +396,7 @@ nlmsvc_match_sb(void *datap, struct nlm_file *file)
+@@ -395,7 +395,7 @@ nlmsvc_match_sb(void *datap, struct nlm_file *file)
{
struct super_block *sb = datap;
@@ -308,20 +272,28 @@ index 198b4e5..2109091 100644
}
/**
-diff --git a/fs/nfs/client.c b/fs/nfs/client.c
-index 5ee23e7..afbb834 100644
---- a/fs/nfs/client.c
-+++ b/fs/nfs/client.c
-@@ -248,6 +248,7 @@ static int nfs_sockaddr_match_ipaddr(const struct sockaddr *sa1,
- (const struct sockaddr_in6 *)sa2);
- }
- BUG();
-+ return -EINVAL;
- }
-
- /*
+diff --git a/fs/nfs/Makefile b/fs/nfs/Makefile
+index 8451598..fdde308 100644
+--- a/fs/nfs/Makefile
++++ b/fs/nfs/Makefile
+@@ -6,7 +6,7 @@ obj-$(CONFIG_NFS_FS) += nfs.o
+
+ nfs-y := client.o dir.o file.o getroot.o inode.o super.o nfs2xdr.o \
+ direct.o pagelist.o proc.o read.o symlink.o unlink.o \
+- write.o namespace.o mount_clnt.o
++ write.o namespace.o mount_clnt.o backport-namespace.o writeback.o
+ nfs-$(CONFIG_ROOT_NFS) += nfsroot.o
+ nfs-$(CONFIG_NFS_V3) += nfs3proc.o nfs3xdr.o
+ nfs-$(CONFIG_NFS_V3_ACL) += nfs3acl.o
+diff --git a/fs/nfs/backport-namespace.c b/fs/nfs/backport-namespace.c
+new file mode 100644
+index 0000000..de57f8b
+--- /dev/null
++++ b/fs/nfs/backport-namespace.c
+@@ -0,0 +1 @@
++#include "src/namespace.c"
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
-index 74f92b7..90d0a97 100644
+index 370b190..56585c3 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -66,7 +66,7 @@ const struct file_operations nfs_dir_operations = {
@@ -362,25 +334,25 @@ index 74f92b7..90d0a97 100644
nfs_inc_stats(inode, NFSIOS_VFSOPEN);
-@@ -175,7 +175,7 @@ static
+@@ -176,7 +176,7 @@ static
int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page *page)
{
struct file *file = desc->file;
- struct inode *inode = file->f_path.dentry->d_inode;
+ struct inode *inode = file->f_dentry->d_inode;
struct rpc_cred *cred = nfs_file_cred(file);
- unsigned long timestamp;
+ unsigned long timestamp, gencount;
int error;
-@@ -186,7 +186,7 @@ int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page *page)
-
+@@ -188,7 +188,7 @@ int nfs_readdir_filler(nfs_readdir_descriptor_t *desc, struct page *page)
again:
timestamp = jiffies;
+ gencount = nfs_inc_attr_generation_counter();
- error = NFS_PROTO(inode)->readdir(file->f_path.dentry, cred, desc->entry->cookie, page,
+ error = NFS_PROTO(inode)->readdir(file->f_dentry, cred, desc->entry->cookie, page,
NFS_SERVER(inode)->dtsize, desc->plus);
if (error < 0) {
/* We requested READDIRPLUS, but the server doesn't grok it */
-@@ -311,7 +311,7 @@ int find_dirent_index(nfs_readdir_descriptor_t *desc)
+@@ -315,7 +315,7 @@ int find_dirent_index(nfs_readdir_descriptor_t *desc)
static inline
int find_dirent_page(nfs_readdir_descriptor_t *desc)
{
@@ -389,7 +361,7 @@ index 74f92b7..90d0a97 100644
struct page *page;
int status;
-@@ -467,7 +467,7 @@ int uncached_readdir(nfs_readdir_descriptor_t *desc, void *dirent,
+@@ -471,7 +471,7 @@ int uncached_readdir(nfs_readdir_descriptor_t *desc, void *dirent,
filldir_t filldir)
{
struct file *file = desc->file;
@@ -398,16 +370,16 @@ index 74f92b7..90d0a97 100644
struct rpc_cred *cred = nfs_file_cred(file);
struct page *page = NULL;
int status;
-@@ -482,7 +482,7 @@ int uncached_readdir(nfs_readdir_descriptor_t *desc, void *dirent,
- goto out;
+@@ -487,7 +487,7 @@ int uncached_readdir(nfs_readdir_descriptor_t *desc, void *dirent,
}
timestamp = jiffies;
+ gencount = nfs_inc_attr_generation_counter();
- status = NFS_PROTO(inode)->readdir(file->f_path.dentry, cred,
+ status = NFS_PROTO(inode)->readdir(file->f_dentry, cred,
*desc->dir_cookie, page,
NFS_SERVER(inode)->dtsize,
desc->plus);
-@@ -520,7 +520,7 @@ int uncached_readdir(nfs_readdir_descriptor_t *desc, void *dirent,
+@@ -526,7 +526,7 @@ int uncached_readdir(nfs_readdir_descriptor_t *desc, void *dirent,
*/
static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
{
@@ -416,7 +388,7 @@ index 74f92b7..90d0a97 100644
struct inode *inode = dentry->d_inode;
nfs_readdir_descriptor_t my_desc,
*desc = &my_desc;
-@@ -601,7 +601,7 @@ out:
+@@ -607,7 +607,7 @@ out:
static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int origin)
{
@@ -425,7 +397,25 @@ index 74f92b7..90d0a97 100644
struct inode *inode = dentry->d_inode;
dfprintk(FILE, "NFS: llseek dir(%s/%s, %lld, %d)\n",
-@@ -973,7 +973,7 @@ static int is_atomic_open(struct inode *dir, struct nameidata *nd)
+@@ -899,7 +899,7 @@ static void nfs_dentry_iput(struct dentry *dentry, struct inode *inode)
+ iput(inode);
+ }
+
+-const struct dentry_operations nfs_dentry_operations = {
++struct dentry_operations nfs_dentry_operations = {
+ .d_revalidate = nfs_lookup_revalidate,
+ .d_delete = nfs_dentry_delete,
+ .d_iput = nfs_dentry_iput,
+@@ -967,7 +967,7 @@ out:
+ #ifdef CONFIG_NFS_V4
+ static int nfs_open_revalidate(struct dentry *, struct nameidata *);
+
+-const struct dentry_operations nfs4_dentry_operations = {
++struct dentry_operations nfs4_dentry_operations = {
+ .d_revalidate = nfs_open_revalidate,
+ .d_delete = nfs_dentry_delete,
+ .d_iput = nfs_dentry_iput,
+@@ -985,7 +985,7 @@ static int is_atomic_open(struct nameidata *nd)
if (nd->flags & LOOKUP_DIRECTORY)
return 0;
/* Are we trying to write to a read only partition? */
@@ -434,7 +424,7 @@ index 74f92b7..90d0a97 100644
(nd->intent.open.flags & (O_CREAT|O_TRUNC|FMODE_WRITE)))
return 0;
return 1;
-@@ -1083,7 +1083,7 @@ no_open:
+@@ -1094,7 +1094,7 @@ no_open:
static struct dentry *nfs_readdir_lookup(nfs_readdir_descriptor_t *desc)
{
@@ -443,7 +433,7 @@ index 74f92b7..90d0a97 100644
struct inode *dir = parent->d_inode;
struct nfs_entry *entry = desc->entry;
struct dentry *dentry, *alias;
-@@ -1907,7 +1907,7 @@ int nfs_may_open(struct inode *inode, struct rpc_cred *cred, int openflags)
+@@ -1924,7 +1924,7 @@ int nfs_may_open(struct inode *inode, struct rpc_cred *cred, int openflags)
return nfs_do_access(inode, cred, nfs_open_permission_mask(openflags));
}
@@ -452,7 +442,7 @@ index 74f92b7..90d0a97 100644
{
struct rpc_cred *cred;
int res = 0;
-@@ -1917,7 +1917,7 @@ int nfs_permission(struct inode *inode, int mask)
+@@ -1934,7 +1934,7 @@ int nfs_permission(struct inode *inode, int mask)
if ((mask & (MAY_READ | MAY_WRITE | MAY_EXEC)) == 0)
goto out;
/* Is this sys_access() ? */
@@ -461,7 +451,7 @@ index 74f92b7..90d0a97 100644
goto force_lookup;
switch (inode->i_mode & S_IFMT) {
-@@ -1926,7 +1926,8 @@ int nfs_permission(struct inode *inode, int mask)
+@@ -1943,7 +1943,8 @@ int nfs_permission(struct inode *inode, int mask)
case S_IFREG:
/* NFSv4 has atomic_open... */
if (nfs_server_capable(inode, NFS_CAP_ATOMIC_OPEN)
@@ -507,10 +497,10 @@ index 08f6b04..91f5069 100644
retval = generic_write_checks(file, &pos, &count, 0);
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
-index 7846065..7962293 100644
+index ec7e27d..b524170 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
-@@ -45,16 +45,13 @@ static int nfs_file_mmap(struct file *, struct vm_area_struct *);
+@@ -46,16 +46,13 @@ static int nfs_file_mmap(struct file *, struct vm_area_struct *);
static ssize_t nfs_file_splice_read(struct file *filp, loff_t *ppos,
struct pipe_inode_info *pipe,
size_t count, unsigned int flags);
@@ -529,7 +519,7 @@ index 7846065..7962293 100644
static struct vm_operations_struct nfs_file_vm_ops;
-@@ -77,17 +74,16 @@ const struct file_operations nfs_file_operations = {
+@@ -74,17 +71,16 @@ const struct file_operations nfs_file_operations = {
.flock = nfs_flock,
.splice_read = nfs_file_splice_read,
.check_flags = nfs_check_flags,
@@ -549,7 +539,7 @@ index 7846065..7962293 100644
.permission = nfs_permission,
.getattr = nfs_getattr,
.setattr = nfs_setattr,
-@@ -120,8 +116,8 @@ nfs_file_open(struct inode *inode, struct file *filp)
+@@ -117,8 +113,8 @@ nfs_file_open(struct inode *inode, struct file *filp)
int res;
dprintk("NFS: open file(%s/%s)\n",
@@ -560,7 +550,7 @@ index 7846065..7962293 100644
res = nfs_check_flags(filp->f_flags);
if (res)
-@@ -135,7 +131,7 @@ nfs_file_open(struct inode *inode, struct file *filp)
+@@ -132,7 +128,7 @@ nfs_file_open(struct inode *inode, struct file *filp)
static int
nfs_file_release(struct inode *inode, struct file *filp)
{
@@ -569,12 +559,9 @@ index 7846065..7962293 100644
dprintk("NFS: release(%s/%s)\n",
dentry->d_parent->d_name.name,
-@@ -178,11 +174,9 @@ force_reval:
+@@ -175,8 +171,8 @@ static loff_t nfs_file_llseek(struct file *filp, loff_t offset, int origin)
+ loff_t loff;
- static loff_t nfs_file_llseek(struct file *filp, loff_t offset, int origin)
- {
-- loff_t loff;
--
dprintk("NFS: llseek file(%s/%s, %lld, %d)\n",
- filp->f_path.dentry->d_parent->d_name.name,
- filp->f_path.dentry->d_name.name,
@@ -583,28 +570,31 @@ index 7846065..7962293 100644
offset, origin);
/* origin == SEEK_END => we must revalidate the cached file length */
-@@ -192,10 +186,7 @@ static loff_t nfs_file_llseek(struct file *filp, loff_t offset, int origin)
+@@ -186,12 +182,8 @@ static loff_t nfs_file_llseek(struct file *filp, loff_t offset, int origin)
+ int retval = nfs_revalidate_file_size(inode, filp);
if (retval < 0)
return (loff_t)retval;
- }
-- lock_kernel(); /* BKL needed? */
-- loff = generic_file_llseek_unlocked(filp, offset, origin);
-- unlock_kernel();
-- return loff;
-+ return remote_llseek(filp, offset, origin);
+-
+- spin_lock(&inode->i_lock);
+- loff = generic_file_llseek_unlocked(filp, offset, origin);
+- spin_unlock(&inode->i_lock);
+- } else
+- loff = generic_file_llseek_unlocked(filp, offset, origin);
++ }
++ loff = remote_llseek(filp, offset, origin);
+ return loff;
}
- /*
-@@ -230,7 +221,7 @@ static int
+@@ -227,7 +219,7 @@ static int
nfs_file_flush(struct file *file, fl_owner_t id)
{
struct nfs_open_context *ctx = nfs_file_open_context(file);
- struct dentry *dentry = file->f_path.dentry;
+ struct dentry *dentry = file->f_dentry;
struct inode *inode = dentry->d_inode;
- int status;
-@@ -250,16 +241,15 @@ nfs_file_flush(struct file *file, fl_owner_t id)
+ dprintk("NFS: flush(%s/%s)\n",
+@@ -243,16 +235,15 @@ nfs_file_flush(struct file *file, fl_owner_t id)
}
static ssize_t
@@ -625,7 +615,7 @@ index 7846065..7962293 100644
dprintk("NFS: read(%s/%s, %lu@%lu)\n",
dentry->d_parent->d_name.name, dentry->d_name.name,
-@@ -268,7 +258,7 @@ nfs_file_read(struct kiocb *iocb, const struct iovec *iov,
+@@ -261,7 +252,7 @@ nfs_file_read(struct kiocb *iocb, const struct iovec *iov,
result = nfs_revalidate_mapping(inode, iocb->ki_filp->f_mapping);
nfs_add_stats(inode, NFSIOS_NORMALREADBYTES, count);
if (!result)
@@ -634,7 +624,7 @@ index 7846065..7962293 100644
return result;
}
-@@ -277,7 +267,7 @@ nfs_file_splice_read(struct file *filp, loff_t *ppos,
+@@ -270,7 +261,7 @@ nfs_file_splice_read(struct file *filp, loff_t *ppos,
struct pipe_inode_info *pipe, size_t count,
unsigned int flags)
{
@@ -643,7 +633,7 @@ index 7846065..7962293 100644
struct inode *inode = dentry->d_inode;
ssize_t res;
-@@ -294,7 +284,7 @@ nfs_file_splice_read(struct file *filp, loff_t *ppos,
+@@ -287,7 +278,7 @@ nfs_file_splice_read(struct file *filp, loff_t *ppos,
static int
nfs_file_mmap(struct file * file, struct vm_area_struct * vma)
{
@@ -652,7 +642,7 @@ index 7846065..7962293 100644
struct inode *inode = dentry->d_inode;
int status;
-@@ -337,44 +327,15 @@ nfs_file_fsync(struct file *file, struct dentry *dentry, int datasync)
+@@ -332,82 +323,36 @@ nfs_file_fsync(struct file *file, struct dentry *dentry, int datasync)
* If the writer ends up delaying the write, the writer needs to
* increment the page use counts until he is done with the page.
*/
@@ -671,7 +661,16 @@ index 7846065..7962293 100644
- file->f_path.dentry->d_name.name,
- mapping->host->i_ino, len, (long long) pos);
-
-- page = __grab_cache_page(mapping, index);
+- /*
+- * Prevent starvation issues if someone is doing a consistency
+- * sync-to-disk
+- */
+- ret = wait_on_bit(&NFS_I(mapping->host)->flags, NFS_INO_FLUSHING,
+- nfs_wait_bit_killable, TASK_KILLABLE);
+- if (ret)
+- return ret;
+-
+- page = grab_cache_page_write_begin(mapping, index, flags);
- if (!page)
- return -ENOMEM;
- *pagep = page;
@@ -692,16 +691,15 @@ index 7846065..7962293 100644
{
- unsigned offset = pos & (PAGE_CACHE_SIZE - 1);
int status;
--
+
- dfprintk(PAGECACHE, "NFS: write_end(%s/%s(%ld), %u@%lld)\n",
- file->f_path.dentry->d_parent->d_name.name,
- file->f_path.dentry->d_name.name,
- mapping->host->i_ino, len, (long long) pos);
-+ unsigned copied = to - offset;
-
+-
/*
* Zero any uninitialised parts of the page, and then mark the page
-@@ -382,14 +343,13 @@ static int nfs_write_end(struct file *file, struct address_space *mapping,
+ * as up to date if it turns out that we're extending the file.
*/
if (!PageUptodate(page)) {
unsigned pglen = nfs_page_length(page);
@@ -719,27 +717,43 @@ index 7846065..7962293 100644
if (offset == 0)
SetPageUptodate(page);
} else
-@@ -398,9 +358,6 @@ static int nfs_write_end(struct file *file, struct address_space *mapping,
-
- status = nfs_updatepage(file, page, offset, copied);
+ zero_user_segment(page, pglen, PAGE_CACHE_SIZE);
+ }
+- status = nfs_updatepage(file, page, offset, copied);
+-
- unlock_page(page);
- page_cache_release(page);
-
- if (status < 0)
- return status;
- return copied;
-@@ -424,34 +381,23 @@ static int nfs_release_page(struct page *page, gfp_t gfp)
- return 0;
+- if (status < 0)
+- return status;
+- return copied;
++ status = nfs_updatepage(file, page, offset, to-offset);
++ return status;
}
+ /*
+@@ -445,38 +390,17 @@ static int nfs_release_page(struct page *page, gfp_t gfp)
+ return nfs_fscache_release_page(page, gfp);
+ }
+
+-/*
+- * Attempt to clear the private state associated with a page when an error
+- * occurs that requires the cached contents of an inode to be written back or
+- * destroyed
+- * - Called if either PG_private or fscache is set on the page
+- * - Caller holds page lock
+- * - Return 0 if successful, -error otherwise
+- */
-static int nfs_launder_page(struct page *page)
-{
- struct inode *inode = page->mapping->host;
+- struct nfs_inode *nfsi = NFS_I(inode);
-
- dfprintk(PAGECACHE, "NFS: launder_page(%ld, %llu)\n",
- inode->i_ino, (long long)page_offset(page));
-
+- nfs_fscache_wait_on_page_write(nfsi, page);
- return nfs_wb_page(inode, page);
-}
-
@@ -759,25 +773,40 @@ index 7846065..7962293 100644
- .launder_page = nfs_launder_page,
};
- static int nfs_vm_page_mkwrite(struct vm_area_struct *vma, struct page *page)
+ /*
+@@ -484,11 +408,10 @@ const struct address_space_operations nfs_file_aops = {
+ * writable, implying that someone is about to modify the page through a
+ * shared-writable mapping
+ */
+-static int nfs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
++static int nfs_vm_page_mkwrite(struct vm_area_struct *vma, struct page *page)
{
+- struct page *page = vmf->page;
struct file *filp = vma->vm_file;
- struct dentry *dentry = filp->f_path.dentry;
+ struct dentry *dentry = filp->f_dentry;
unsigned pagelen;
int ret = -EINVAL;
struct address_space *mapping;
-@@ -484,7 +430,8 @@ out_unlock:
+@@ -517,14 +440,15 @@ static int nfs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
+
+ ret = nfs_updatepage(filp, page, 0, pagelen);
+ out_unlock:
++ unlock_page(page);
+ if (!ret)
+ return VM_FAULT_LOCKED;
+- unlock_page(page);
+ return VM_FAULT_SIGBUS;
}
static struct vm_operations_struct nfs_file_vm_ops = {
- .fault = filemap_fault,
-+ .nopage = filemap_nopage,
-+ .populate = filemap_populate,
++ .nopage = filemap_nopage,
++ .populate = filemap_populate,
.page_mkwrite = nfs_vm_page_mkwrite,
};
-@@ -500,16 +447,16 @@ static int nfs_need_sync_write(struct file *filp, struct inode *inode)
+@@ -540,16 +464,16 @@ static int nfs_need_sync_write(struct file *filp, struct inode *inode)
return 0;
}
@@ -799,7 +828,7 @@ index 7846065..7962293 100644
dprintk("NFS: write(%s/%s, %lu@%Ld)\n",
dentry->d_parent->d_name.name, dentry->d_name.name,
-@@ -532,7 +479,7 @@ static ssize_t nfs_file_write(struct kiocb *iocb, const struct iovec *iov,
+@@ -572,7 +496,7 @@ static ssize_t nfs_file_write(struct kiocb *iocb, const struct iovec *iov,
goto out;
nfs_add_stats(inode, NFSIOS_NORMALWRITTENBYTES, count);
@@ -808,7 +837,7 @@ index 7846065..7962293 100644
/* Return error values for O_SYNC and IS_SYNC() */
if (result >= 0 && nfs_need_sync_write(iocb->ki_filp, inode)) {
int err = nfs_do_fsync(nfs_file_open_context(iocb->ki_filp), inode);
-@@ -549,14 +496,19 @@ out_swapfile:
+@@ -589,14 +513,19 @@ out_swapfile:
static int do_getlk(struct file *filp, int cmd, struct file_lock *fl)
{
@@ -830,7 +859,7 @@ index 7846065..7962293 100644
goto out;
}
-@@ -662,8 +614,8 @@ static int nfs_lock(struct file *filp, int cmd, struct file_lock *fl)
+@@ -702,8 +631,8 @@ static int nfs_lock(struct file *filp, int cmd, struct file_lock *fl)
int ret = -ENOLCK;
dprintk("NFS: lock(%s/%s, t=%x, fl=%x, r=%lld:%lld)\n",
@@ -841,7 +870,7 @@ index 7846065..7962293 100644
fl->fl_type, fl->fl_flags,
(long long)fl->fl_start, (long long)fl->fl_end);
-@@ -695,8 +647,8 @@ out_err:
+@@ -735,8 +664,8 @@ out_err:
static int nfs_flock(struct file *filp, int cmd, struct file_lock *fl)
{
dprintk("NFS: flock(%s/%s, t=%x, fl=%x)\n",
@@ -851,8 +880,8 @@ index 7846065..7962293 100644
+ filp->f_dentry->d_name.name,
fl->fl_type, fl->fl_flags);
- /*
-@@ -718,16 +670,3 @@ static int nfs_flock(struct file *filp, int cmd, struct file_lock *fl)
+ if (!(fl->fl_flags & FL_FLOCK))
+@@ -751,16 +680,3 @@ static int nfs_flock(struct file *filp, int cmd, struct file_lock *fl)
return do_unlk(filp, cmd, fl);
return do_setlk(filp, cmd, fl);
}
@@ -869,18 +898,63 @@ index 7846065..7962293 100644
-
- return -EINVAL;
-}
-diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c
-index fae9719..5bf9b3c 100644
---- a/fs/nfs/getroot.c
-+++ b/fs/nfs/getroot.c
-@@ -30,7 +30,6 @@
- #include <linux/nfs_idmap.h>
- #include <linux/vfs.h>
- #include <linux/namei.h>
--#include <linux/mnt_namespace.h>
- #include <linux/security.h>
-
- #include <asm/system.h>
+diff --git a/fs/nfs/fscache-index.c b/fs/nfs/fscache-index.c
+index 5b10064..8970249 100644
+--- a/fs/nfs/fscache-index.c
++++ b/fs/nfs/fscache-index.c
+@@ -107,7 +107,7 @@ static uint16_t nfs_server_get_key(const void *cookie_netfs_data,
+ * object to fscache_acquire_cookie(). It is keyed by the NFS protocol and
+ * server address parameters.
+ */
+-const struct fscache_cookie_def nfs_fscache_server_index_def = {
++struct fscache_cookie_def nfs_fscache_server_index_def = {
+ .name = "NFS.server",
+ .type = FSCACHE_COOKIE_TYPE_INDEX,
+ .get_key = nfs_server_get_key,
+@@ -141,7 +141,7 @@ static uint16_t nfs_super_get_key(const void *cookie_netfs_data,
+ * superblock object to fscache_acquire_cookie(). It is keyed by all the NFS
+ * parameters that might cause a separate superblock.
+ */
+-const struct fscache_cookie_def nfs_fscache_super_index_def = {
++struct fscache_cookie_def nfs_fscache_super_index_def = {
+ .name = "NFS.super",
+ .type = FSCACHE_COOKIE_TYPE_INDEX,
+ .get_key = nfs_super_get_key,
+@@ -228,7 +228,7 @@ static uint16_t nfs_fscache_inode_get_aux(const void *cookie_netfs_data,
+ * presented, as is the auxiliary data
+ */
+ static
+-enum fscache_checkaux nfs_fscache_inode_check_aux(void *cookie_netfs_data,
++fscache_checkaux_t nfs_fscache_inode_check_aux(void *cookie_netfs_data,
+ const void *data,
+ uint16_t datalen)
+ {
+@@ -324,7 +324,7 @@ static void nfs_fh_put_context(void *cookie_netfs_data, void *context)
+ * held in the cache auxiliary data for the data storage object with those in
+ * the inode struct in memory.
+ */
+-const struct fscache_cookie_def nfs_fscache_inode_object_def = {
++struct fscache_cookie_def nfs_fscache_inode_object_def = {
+ .name = "NFS.fh",
+ .type = FSCACHE_COOKIE_TYPE_DATAFILE,
+ .get_key = nfs_fscache_inode_get_key,
+diff --git a/fs/nfs/fscache.h b/fs/nfs/fscache.h
+index 6e809bb..aed2aad 100644
+--- a/fs/nfs/fscache.h
++++ b/fs/nfs/fscache.h
+@@ -60,9 +60,9 @@ struct nfs_fscache_key {
+ * fscache-index.c
+ */
+ extern struct fscache_netfs nfs_fscache_netfs;
+-extern const struct fscache_cookie_def nfs_fscache_server_index_def;
+-extern const struct fscache_cookie_def nfs_fscache_super_index_def;
+-extern const struct fscache_cookie_def nfs_fscache_inode_object_def;
++extern struct fscache_cookie_def nfs_fscache_server_index_def;
++extern struct fscache_cookie_def nfs_fscache_super_index_def;
++extern struct fscache_cookie_def nfs_fscache_inode_object_def;
+
+ extern int nfs_fscache_register(void);
+ extern void nfs_fscache_unregister(void);
diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c
index 86147b0..148aebe 100644
--- a/fs/nfs/idmap.c
@@ -895,10 +969,10 @@ index 86147b0..148aebe 100644
struct idmap_msg im_in, *im = &idmap->idmap_im;
struct idmap_hashtable *h;
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
-index 52daefa..6a5b54c 100644
+index 64f8719..2c50380 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
-@@ -612,7 +612,7 @@ static void put_nfs_open_context_sync(struct nfs_open_context *ctx)
+@@ -628,7 +628,7 @@ static void put_nfs_open_context_sync(struct nfs_open_context *ctx)
*/
static void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx)
{
@@ -907,7 +981,7 @@ index 52daefa..6a5b54c 100644
struct nfs_inode *nfsi = NFS_I(inode);
filp->private_data = get_nfs_open_context(ctx);
-@@ -644,7 +644,7 @@ struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_c
+@@ -660,7 +660,7 @@ struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_c
static void nfs_file_clear_open_context(struct file *filp)
{
@@ -916,7 +990,7 @@ index 52daefa..6a5b54c 100644
struct nfs_open_context *ctx = nfs_file_open_context(filp);
if (ctx) {
-@@ -667,7 +667,7 @@ int nfs_open(struct inode *inode, struct file *filp)
+@@ -683,7 +683,7 @@ int nfs_open(struct inode *inode, struct file *filp)
cred = rpc_lookup_cred();
if (IS_ERR(cred))
return PTR_ERR(cred);
@@ -925,7 +999,33 @@ index 52daefa..6a5b54c 100644
put_rpccred(cred);
if (ctx == NULL)
return -ENOMEM;
-@@ -1242,7 +1242,7 @@ static inline void nfs4_init_once(struct nfs_inode *nfsi)
+@@ -948,14 +948,14 @@ static int nfs_check_inode_attributes(struct inode *inode, struct nfs_fattr *fat
+ return 0;
+ }
+
+-static int nfs_ctime_need_update(const struct inode *inode, const struct nfs_fattr *fattr)
++static int nfs_ctime_need_update(struct inode *inode, struct nfs_fattr *fattr)
+ {
+ if (!(fattr->valid & NFS_ATTR_FATTR_CTIME))
+ return 0;
+ return timespec_compare(&fattr->ctime, &inode->i_ctime) > 0;
+ }
+
+-static int nfs_size_need_update(const struct inode *inode, const struct nfs_fattr *fattr)
++static int nfs_size_need_update(struct inode *inode, struct nfs_fattr *fattr)
+ {
+ if (!(fattr->valid & NFS_ATTR_FATTR_SIZE))
+ return 0;
+@@ -1000,7 +1000,7 @@ void nfs_fattr_init(struct nfs_fattr *fattr)
+ * more recent than the ones cached in the inode.
+ *
+ */
+-static int nfs_inode_attrs_need_update(const struct inode *inode, const struct nfs_fattr *fattr)
++static int nfs_inode_attrs_need_update(struct inode *inode, struct nfs_fattr *fattr)
+ {
+ const struct nfs_inode *nfsi = NFS_I(inode);
+
+@@ -1372,7 +1372,7 @@ static inline void nfs4_init_once(struct nfs_inode *nfsi)
#endif
}
@@ -934,13 +1034,24 @@ index 52daefa..6a5b54c 100644
{
struct nfs_inode *nfsi = (struct nfs_inode *) foo;
+@@ -1443,6 +1443,10 @@ static int __init init_nfs_fs(void)
+ {
+ int err;
+
++ err = init_mnt_writers();
++ if (err)
++ goto out7;
++
+ err = nfs_fscache_register();
+ if (err < 0)
+ goto out7;
diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c
-index 66df08d..1e11b1d 100644
+index 64a288e..0ba15d4 100644
--- a/fs/nfs/namespace.c
+++ b/fs/nfs/namespace.c
-@@ -107,29 +107,29 @@ static void * nfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd)
+@@ -110,29 +110,29 @@ static void * nfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd)
+ goto out_err;
- BUG_ON(IS_ROOT(dentry));
dprintk("%s: enter\n", __func__);
- dput(nd->path.dentry);
- nd->path.dentry = dget(dentry);
@@ -975,7 +1086,7 @@ index 66df08d..1e11b1d 100644
&nfs_automount_list);
if (err < 0) {
mntput(mnt);
-@@ -137,9 +137,9 @@ static void * nfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd)
+@@ -140,9 +140,9 @@ static void * nfs_follow_mountpoint(struct dentry *dentry, struct nameidata *nd)
goto out_follow;
goto out_err;
}
@@ -988,7 +1099,7 @@ index 66df08d..1e11b1d 100644
schedule_delayed_work(&nfs_automount_task, nfs_mountpoint_expiry_timeout);
out:
dprintk("%s: done, returned %d\n", __func__, err);
-@@ -147,22 +147,22 @@ out:
+@@ -150,22 +150,22 @@ out:
dprintk("<-- nfs_follow_mountpoint() = %d\n", err);
return ERR_PTR(err);
out_err:
@@ -1017,10 +1128,10 @@ index 66df08d..1e11b1d 100644
};
diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
-index 1e750e4..bdeef69 100644
+index d0cc5ce..d112912 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
-@@ -779,7 +779,7 @@ static void nfs3_proc_commit_setup(struct nfs_write_data *data, struct rpc_messa
+@@ -795,7 +795,7 @@ static void nfs3_proc_commit_setup(struct nfs_write_data *data, struct rpc_messa
static int
nfs3_proc_lock(struct file *filp, int cmd, struct file_lock *fl)
{
@@ -1030,23 +1141,25 @@ index 1e750e4..bdeef69 100644
return nlmclnt_proc(NFS_SERVER(inode)->nlm_host, cmd, fl);
}
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
-index ea79064..7a8e6fa 100644
+index 84345de..a98b322 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
-@@ -165,7 +165,7 @@ struct nfs4_state_recovery_ops {
+@@ -179,8 +179,8 @@ struct nfs4_state_recovery_ops {
+ int (*recover_lock)(struct nfs4_state *, struct file_lock *);
};
- extern struct dentry_operations nfs4_dentry_operations;
+-extern const struct dentry_operations nfs4_dentry_operations;
-extern const struct inode_operations nfs4_dir_inode_operations;
++extern struct dentry_operations nfs4_dentry_operations;
+extern struct inode_operations nfs4_dir_inode_operations;
/* inode.c */
extern ssize_t nfs4_getxattr(struct dentry *, const char *, void *, size_t);
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
-index c910413..02f1156 100644
+index a4d2426..84285cd 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
-@@ -1384,7 +1384,7 @@ struct dentry *
+@@ -1487,7 +1487,7 @@ struct dentry *
nfs4_atomic_open(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
{
struct path path = {
@@ -1055,18 +1168,7 @@ index c910413..02f1156 100644
.dentry = dentry,
};
struct dentry *parent;
-@@ -1421,8 +1421,8 @@ nfs4_atomic_open(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
- }
- res = d_add_unique(dentry, igrab(state->inode));
- if (res != NULL)
-- path.dentry = res;
-- nfs_set_verifier(path.dentry, nfs_save_change_attribute(dir));
-+ dentry = res;
-+ nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
- nfs_unblock_sillyrename(parent);
- nfs4_intent_set_file(nd, &path, state);
- return res;
-@@ -1432,7 +1432,7 @@ int
+@@ -1536,7 +1536,7 @@ int
nfs4_open_revalidate(struct inode *dir, struct dentry *dentry, int openflags, struct nameidata *nd)
{
struct path path = {
@@ -1075,7 +1177,7 @@ index c910413..02f1156 100644
.dentry = dentry,
};
struct rpc_cred *cred;
-@@ -1880,7 +1880,7 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
+@@ -1999,7 +1999,7 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
int flags, struct nameidata *nd)
{
struct path path = {
@@ -1084,7 +1186,7 @@ index c910413..02f1156 100644
.dentry = dentry,
};
struct nfs4_state *state;
-@@ -3671,7 +3671,7 @@ struct nfs4_state_recovery_ops nfs4_network_partition_recovery_ops = {
+@@ -3740,7 +3740,7 @@ struct nfs4_state_recovery_ops nfs4_nograce_recovery_ops = {
.recover_lock = nfs4_lock_expired,
};
@@ -1093,11 +1195,35 @@ index c910413..02f1156 100644
.permission = nfs_permission,
.getattr = nfs_getattr,
.setattr = nfs_setattr,
+diff --git a/fs/nfs/nfsroot.c b/fs/nfs/nfsroot.c
+index d9ef602..00e51a5 100644
+--- a/fs/nfs/nfsroot.c
++++ b/fs/nfs/nfsroot.c
+@@ -331,7 +331,7 @@ static int __init root_nfs_addr(void)
+ }
+
+ snprintf(nfs_data.hostname, sizeof(nfs_data.hostname),
+- "%pI4", &servaddr);
++ NIPQUAD_FMT, NIPQUAD(servaddr));
+ return 0;
+ }
+
+@@ -423,8 +423,8 @@ static int __init root_nfs_getport(int program, int version, int proto)
+ {
+ struct sockaddr_in sin;
+
+- printk(KERN_NOTICE "Looking up port of RPC %d/%d on %pI4\n",
+- program, version, &servaddr);
++ printk(KERN_NOTICE "Looking up port of RPC %d/%d on "NIPQUAD_FMT"\n",
++ program, version, NIPQUAD(servaddr));
+ set_sockaddr(&sin, servaddr, 0);
+ return rpcb_getport_sync(&sin, program, version, proto);
+ }
diff --git a/fs/nfs/proc.c b/fs/nfs/proc.c
-index 4dbb84d..c351a41 100644
+index 7be72d9..d1fcb5d 100644
--- a/fs/nfs/proc.c
+++ b/fs/nfs/proc.c
-@@ -595,7 +595,7 @@ nfs_proc_commit_setup(struct nfs_write_data *data, struct rpc_message *msg)
+@@ -601,7 +601,7 @@ nfs_proc_commit_setup(struct nfs_write_data *data, struct rpc_message *msg)
static int
nfs_proc_lock(struct file *filp, int cmd, struct file_lock *fl)
{
@@ -1107,10 +1233,37 @@ index 4dbb84d..c351a41 100644
return nlmclnt_proc(NFS_SERVER(inode)->nlm_host, cmd, fl);
}
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
-index e9b2017..85ea5fd 100644
+index 6717200..3b5967b 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
-@@ -201,7 +201,7 @@ static match_table_t nfs_secflavor_tokens = {
+@@ -103,7 +103,7 @@ enum {
+ Opt_err
+ };
+
+-static const match_table_t nfs_mount_option_tokens = {
++static match_table_t nfs_mount_option_tokens = {
+ { Opt_userspace, "bg" },
+ { Opt_userspace, "fg" },
+ { Opt_userspace, "retry=%s" },
+@@ -175,7 +175,7 @@ enum {
+ Opt_xprt_err
+ };
+
+-static const match_table_t nfs_xprt_protocol_tokens = {
++static match_table_t nfs_xprt_protocol_tokens = {
+ { Opt_xprt_udp, "udp" },
+ { Opt_xprt_tcp, "tcp" },
+ { Opt_xprt_rdma, "rdma" },
+@@ -192,7 +192,7 @@ enum {
+ Opt_sec_err
+ };
+
+-static const match_table_t nfs_secflavor_tokens = {
++static match_table_t nfs_secflavor_tokens = {
+ { Opt_sec_none, "none" },
+ { Opt_sec_none, "null" },
+ { Opt_sec_sys, "sys" },
+@@ -229,7 +229,7 @@ static match_table_t nfs_lookupcache_tokens = {
};
@@ -1119,7 +1272,7 @@ index e9b2017..85ea5fd 100644
static int nfs_statfs(struct dentry *, struct kstatfs *);
static int nfs_show_options(struct seq_file *, struct vfsmount *);
static int nfs_show_stats(struct seq_file *, struct vfsmount *);
-@@ -228,7 +228,7 @@ struct file_system_type nfs_xdev_fs_type = {
+@@ -255,7 +255,7 @@ struct file_system_type nfs_xdev_fs_type = {
.fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA,
};
@@ -1128,7 +1281,7 @@ index e9b2017..85ea5fd 100644
.alloc_inode = nfs_alloc_inode,
.destroy_inode = nfs_destroy_inode,
.write_inode = nfs_write_inode,
-@@ -274,7 +274,7 @@ struct file_system_type nfs4_referral_fs_type = {
+@@ -300,7 +300,7 @@ struct file_system_type nfs4_referral_fs_type = {
.fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA,
};
@@ -1137,7 +1290,7 @@ index e9b2017..85ea5fd 100644
.alloc_inode = nfs_alloc_inode,
.destroy_inode = nfs_destroy_inode,
.write_inode = nfs_write_inode,
-@@ -287,10 +287,7 @@ static const struct super_operations nfs4_sops = {
+@@ -313,10 +313,7 @@ static const struct super_operations nfs4_sops = {
};
#endif
@@ -1149,7 +1302,7 @@ index e9b2017..85ea5fd 100644
/*
* Register the NFS filesystems
-@@ -311,7 +308,7 @@ int __init register_nfs_fs(void)
+@@ -337,7 +334,7 @@ int __init register_nfs_fs(void)
if (ret < 0)
goto error_2;
#endif
@@ -1158,7 +1311,7 @@ index e9b2017..85ea5fd 100644
return 0;
#ifdef CONFIG_NFS_V4
-@@ -329,7 +326,8 @@ error_0:
+@@ -355,7 +352,8 @@ error_0:
*/
void __exit unregister_nfs_fs(void)
{
@@ -1168,7 +1321,22 @@ index e9b2017..85ea5fd 100644
#ifdef CONFIG_NFS_V4
unregister_filesystem(&nfs4_fs_type);
#endif
-@@ -649,11 +647,13 @@ static int nfs_show_stats(struct seq_file *m, struct vfsmount *mnt)
+@@ -471,12 +469,12 @@ static void nfs_show_mountd_options(struct seq_file *m, struct nfs_server *nfss,
+ switch (sap->sa_family) {
+ case AF_INET: {
+ struct sockaddr_in *sin = (struct sockaddr_in *)sap;
+- seq_printf(m, ",mountaddr=%pI4", &sin->sin_addr.s_addr);
++ seq_printf(m, ",mountaddr="NIPQUAD_FMT, NIPQUAD(sin->sin_addr.s_addr));
+ break;
+ }
+ case AF_INET6: {
+ struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sap;
+- seq_printf(m, ",mountaddr=%pI6", &sin6->sin6_addr);
++ seq_printf(m, ",mountaddr="NIP6_FMT, NIP6(sin6->sin6_addr));
+ break;
+ }
+ default:
+@@ -681,11 +679,14 @@ static int nfs_show_stats(struct seq_file *m, struct vfsmount *mnt)
* Begin unmount by attempting to remove all automounted mountpoints we added
* in response to xdev traversals and referrals
*/
@@ -1181,6 +1349,7 @@ index e9b2017..85ea5fd 100644
+ if (!(flags & MNT_FORCE))
+ return;
++
/* -EIO all pending I/O */
rpc = server->client_acl;
if (!IS_ERR(rpc))
@@ -1198,37 +1367,18 @@ index 412738d..b17f14a 100644
.follow_link = nfs_follow_link,
.put_link = page_put_link,
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
-index 3229e21..7dd87ba 100644
+index e560a78..d623b02 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
-@@ -20,6 +20,8 @@
- #include <linux/nfs_page.h>
- #include <linux/backing-dev.h>
-
+@@ -12,6 +12,7 @@
+ #include <linux/pagemap.h>
+ #include <linux/file.h>
+ #include <linux/writeback.h>
+#include <linux/mpage.h>
-+
- #include <asm/uaccess.h>
+ #include <linux/swap.h>
- #include "delegation.h"
-@@ -198,7 +200,7 @@ static int nfs_set_page_writeback(struct page *page)
- struct inode *inode = page->mapping->host;
- struct nfs_server *nfss = NFS_SERVER(inode);
-
-- if (atomic_long_inc_return(&nfss->writeback) >
-+ if (atomic_long_inc_return((atomic_long_t *)&nfss->writeback) >
- NFS_CONGESTION_ON_THRESH)
- set_bdi_congested(&nfss->backing_dev_info, WRITE);
- }
-@@ -211,7 +213,7 @@ static void nfs_end_page_writeback(struct page *page)
- struct nfs_server *nfss = NFS_SERVER(inode);
-
- end_page_writeback(page);
-- if (atomic_long_dec_return(&nfss->writeback) < NFS_CONGESTION_OFF_THRESH)
-+ if (atomic_long_dec_return((atomic_long_t *)&nfss->writeback) < NFS_CONGESTION_OFF_THRESH)
- clear_bdi_congested(&nfss->backing_dev_info, WRITE);
- }
-
-@@ -726,8 +728,8 @@ int nfs_updatepage(struct file *file, struct page *page,
+ #include <linux/sunrpc/clnt.h>
+@@ -748,8 +749,8 @@ int nfs_updatepage(struct file *file, struct page *page,
nfs_inc_stats(inode, NFSIOS_VFSUPDATEPAGE);
dprintk("NFS: nfs_updatepage(%s/%s %d@%lld)\n",
@@ -1239,29 +1389,135 @@ index 3229e21..7dd87ba 100644
(long long)(page_offset(page) + offset));
/* If we're not using byte range locks, and we know the page
+diff --git a/fs/nfs/writeback.c b/fs/nfs/writeback.c
+new file mode 100644
+index 0000000..b838ead
+--- /dev/null
++++ b/fs/nfs/writeback.c
+@@ -0,0 +1 @@
++#include "src/writeback.c"
+diff --git a/fs/nfsd/auth.c b/fs/nfsd/auth.c
+index 5573508..294992e 100644
+--- a/fs/nfsd/auth.c
++++ b/fs/nfsd/auth.c
+@@ -27,73 +27,53 @@ int nfsexp_flags(struct svc_rqst *rqstp, struct svc_export *exp)
+
+ int nfsd_setuser(struct svc_rqst *rqstp, struct svc_export *exp)
+ {
+- struct group_info *rqgi;
+- struct group_info *gi;
+- struct cred *new;
++ struct svc_cred cred = rqstp->rq_cred;
+ int i;
+ int flags = nfsexp_flags(rqstp, exp);
+ int ret;
+
+- /* discard any old override before preparing the new set */
+- revert_creds(get_cred(current->real_cred));
+- new = prepare_creds();
+- if (!new)
+- return -ENOMEM;
+-
+- new->fsuid = rqstp->rq_cred.cr_uid;
+- new->fsgid = rqstp->rq_cred.cr_gid;
+-
+- rqgi = rqstp->rq_cred.cr_group_info;
+-
+ if (flags & NFSEXP_ALLSQUASH) {
+- new->fsuid = exp->ex_anon_uid;
+- new->fsgid = exp->ex_anon_gid;
+- gi = groups_alloc(0);
+- if (!gi)
+- goto oom;
++ cred.cr_uid = exp->ex_anon_uid;
++ cred.cr_gid = exp->ex_anon_gid;
++ cred.cr_group_info = groups_alloc(0);
+ } else if (flags & NFSEXP_ROOTSQUASH) {
+- if (!new->fsuid)
+- new->fsuid = exp->ex_anon_uid;
+- if (!new->fsgid)
+- new->fsgid = exp->ex_anon_gid;
+-
+- gi = groups_alloc(rqgi->ngroups);
+- if (!gi)
+- goto oom;
++ struct group_info *gi;
++ if (!cred.cr_uid)
++ cred.cr_uid = exp->ex_anon_uid;
++ if (!cred.cr_gid)
++ cred.cr_gid = exp->ex_anon_gid;
++ gi = groups_alloc(cred.cr_group_info->ngroups);
++ if (gi)
++ for (i = 0; i < cred.cr_group_info->ngroups; i++) {
++ if (!GROUP_AT(cred.cr_group_info, i))
++ GROUP_AT(gi, i) = exp->ex_anon_gid;
++ else
++ GROUP_AT(gi, i) = GROUP_AT(cred.cr_group_info, i);
++ }
++ cred.cr_group_info = gi;
++ } else
++ get_group_info(cred.cr_group_info);
++
++ if (cred.cr_uid != (uid_t) -1)
++ current->fsuid = cred.cr_uid;
++ else
++ current->fsuid = exp->ex_anon_uid;
++ if (cred.cr_gid != (gid_t) -1)
++ current->fsgid = cred.cr_gid;
++ else
++ current->fsgid = exp->ex_anon_gid;
+
+- for (i = 0; i < rqgi->ngroups; i++) {
+- if (!GROUP_AT(rqgi, i))
+- GROUP_AT(gi, i) = exp->ex_anon_gid;
+- else
+- GROUP_AT(gi, i) = GROUP_AT(rqgi, i);
+- }
++ if (!cred.cr_group_info)
++ return -ENOMEM;
++ ret = set_current_groups(cred.cr_group_info);
++ put_group_info(cred.cr_group_info);
++ if ((cred.cr_uid)) {
++ current->cap_effective =
++ cap_drop_nfsd_set(current->cap_effective);
+ } else {
+- gi = get_group_info(rqgi);
++ current->cap_effective =
++ cap_raise_nfsd_set(current->cap_effective,
++ current->cap_permitted);
+ }
+-
+- if (new->fsuid == (uid_t) -1)
+- new->fsuid = exp->ex_anon_uid;
+- if (new->fsgid == (gid_t) -1)
+- new->fsgid = exp->ex_anon_gid;
+-
+- ret = set_groups(new, gi);
+- put_group_info(gi);
+- if (ret < 0)
+- goto error;
+-
+- if (new->fsuid)
+- new->cap_effective = cap_drop_nfsd_set(new->cap_effective);
+- else
+- new->cap_effective = cap_raise_nfsd_set(new->cap_effective,
+- new->cap_permitted);
+- put_cred(override_creds(new));
+- put_cred(new);
+- return 0;
+-
+-oom:
+- ret = -ENOMEM;
+-error:
+- abort_creds(new);
+ return ret;
+ }
+-
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
-index 9dc036f..4bafc01 100644
+index 5839b22..1850a29 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
-@@ -168,14 +168,15 @@ static int expkey_parse(struct cache_detail *cd, char *mesg, int mlen)
- goto out;
-
- dprintk("Found the path %s\n", buf);
-- key.ek_path = nd.path;
-+ key.ek_path.dentry = nd.dentry;
-+ key.ek_path.mnt = nd.mnt;
-
- ek = svc_expkey_update(&key, ek);
- if (ek)
- cache_put(&ek->h, &svc_expkey_cache);
- else
- err = -ENOMEM;
-- path_put(&nd.path);
-+ backport_path_put(&nd);
- }
- cache_flush();
- out:
-@@ -204,7 +205,7 @@ static int expkey_show(struct seq_file *m,
+@@ -203,7 +203,7 @@ static int expkey_show(struct seq_file *m,
if (test_bit(CACHE_VALID, &h->flags) &&
!test_bit(CACHE_NEGATIVE, &h->flags)) {
seq_printf(m, " ");
@@ -1270,7 +1526,7 @@ index 9dc036f..4bafc01 100644
}
seq_printf(m, "\n");
return 0;
-@@ -346,7 +347,7 @@ static void svc_export_request(struct cache_detail *cd,
+@@ -345,7 +345,7 @@ static void svc_export_request(struct cache_detail *cd,
char *pth;
qword_add(bpp, blen, exp->ex_client->name);
@@ -1279,7 +1535,7 @@ index 9dc036f..4bafc01 100644
if (IS_ERR(pth)) {
/* is this correct? */
(*bpp)[0] = '\n';
-@@ -385,7 +386,7 @@ static int check_export(struct inode *inode, int flags, unsigned char *uuid)
+@@ -384,7 +384,7 @@ static int check_export(struct inode *inode, int flags, unsigned char *uuid)
}
if (!inode->i_sb->s_export_op ||
@@ -1288,47 +1544,7 @@ index 9dc036f..4bafc01 100644
dprintk("exp_export: export of invalid fs type.\n");
return -EINVAL;
}
-@@ -504,7 +505,7 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
- struct svc_export exp, *expp;
- int an_int;
-
-- nd.path.dentry = NULL;
-+ nd.dentry = NULL;
- exp.ex_pathname = NULL;
-
- /* fs locations */
-@@ -544,8 +545,8 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
-
- exp.h.flags = 0;
- exp.ex_client = dom;
-- exp.ex_path.mnt = nd.path.mnt;
-- exp.ex_path.dentry = nd.path.dentry;
-+ exp.ex_path.mnt = nd.mnt;
-+ exp.ex_path.dentry = nd.dentry;
- exp.ex_pathname = kstrdup(buf, GFP_KERNEL);
- err = -ENOMEM;
- if (!exp.ex_pathname)
-@@ -607,7 +608,7 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
- goto out;
- }
-
-- err = check_export(nd.path.dentry->d_inode, exp.ex_flags,
-+ err = check_export(nd.dentry->d_inode, exp.ex_flags,
- exp.ex_uuid);
- if (err) goto out;
- }
-@@ -626,8 +627,8 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
- nfsd4_fslocs_free(&exp.ex_fslocs);
- kfree(exp.ex_uuid);
- kfree(exp.ex_pathname);
-- if (nd.path.dentry)
-- path_put(&nd.path);
-+ if (nd.dentry)
-+ backport_path_put(&nd);
- out_no_path:
- if (dom)
- auth_domain_put(dom);
-@@ -650,7 +651,7 @@ static int svc_export_show(struct seq_file *m,
+@@ -642,7 +642,7 @@ static int svc_export_show(struct seq_file *m,
return 0;
}
exp = container_of(h, struct svc_export, h);
@@ -1337,244 +1553,183 @@ index 9dc036f..4bafc01 100644
seq_putc(m, '\t');
seq_escape(m, exp->ex_client->name, " \t\n\\");
seq_putc(m, '(');
-@@ -1026,7 +1027,7 @@ exp_export(struct nfsctl_export *nxp)
- goto out_put_clp;
- err = -EINVAL;
-
-- exp = exp_get_by_name(clp, nd.path.mnt, nd.path.dentry, NULL);
-+ exp = exp_get_by_name(clp, nd.mnt, nd.dentry, NULL);
-
- memset(&new, 0, sizeof(new));
-
-@@ -1034,8 +1035,8 @@ exp_export(struct nfsctl_export *nxp)
- if ((nxp->ex_flags & NFSEXP_FSID) &&
- (!IS_ERR(fsid_key = exp_get_fsid_key(clp, nxp->ex_dev))) &&
- fsid_key->ek_path.mnt &&
-- (fsid_key->ek_path.mnt != nd.path.mnt ||
-- fsid_key->ek_path.dentry != nd.path.dentry))
-+ (fsid_key->ek_path.mnt != nd.mnt ||
-+ fsid_key->ek_path.dentry != nd.dentry))
- goto finish;
-
- if (!IS_ERR(exp)) {
-@@ -1051,7 +1052,7 @@ exp_export(struct nfsctl_export *nxp)
- goto finish;
- }
-
-- err = check_export(nd.path.dentry->d_inode, nxp->ex_flags, NULL);
-+ err = check_export(nd.dentry->d_inode, nxp->ex_flags, NULL);
- if (err) goto finish;
-
- err = -ENOMEM;
-@@ -1064,7 +1065,8 @@ exp_export(struct nfsctl_export *nxp)
- if (!new.ex_pathname)
- goto finish;
- new.ex_client = clp;
-- new.ex_path = nd.path;
-+ new.ex_path.mnt = nd.mnt;
-+ new.ex_path.dentry = nd.dentry;
- new.ex_flags = nxp->ex_flags;
- new.ex_anon_uid = nxp->ex_anon_uid;
- new.ex_anon_gid = nxp->ex_anon_gid;
-@@ -1090,7 +1092,7 @@ finish:
- exp_put(exp);
- if (fsid_key && !IS_ERR(fsid_key))
- cache_put(&fsid_key->h, &svc_expkey_cache);
-- path_put(&nd.path);
-+ backport_path_put(&nd);
- out_put_clp:
- auth_domain_put(clp);
- out_unlock:
-@@ -1143,8 +1145,8 @@ exp_unexport(struct nfsctl_export *nxp)
- goto out_domain;
-
- err = -EINVAL;
-- exp = exp_get_by_name(dom, nd.path.mnt, nd.path.dentry, NULL);
-- path_put(&nd.path);
-+ exp = exp_get_by_name(dom, nd.mnt, nd.dentry, NULL);
-+ backport_path_put(&nd);
- if (IS_ERR(exp))
- goto out_domain;
-
-@@ -1180,12 +1182,12 @@ exp_rootfh(svc_client *clp, char *path, struct knfsd_fh *f, int maxsize)
- printk("nfsd: exp_rootfh path not found %s", path);
- return err;
- }
-- inode = nd.path.dentry->d_inode;
-+ inode = nd.dentry->d_inode;
-
- dprintk("nfsd: exp_rootfh(%s [%p] %s:%s/%ld)\n",
-- path, nd.path.dentry, clp->name,
-+ path, nd.dentry, clp->name,
- inode->i_sb->s_id, inode->i_ino);
-- exp = exp_parent(clp, nd.path.mnt, nd.path.dentry, NULL);
-+ exp = exp_parent(clp, nd.mnt, nd.dentry, NULL);
- if (IS_ERR(exp)) {
- err = PTR_ERR(exp);
- goto out;
-@@ -1195,7 +1197,7 @@ exp_rootfh(svc_client *clp, char *path, struct knfsd_fh *f, int maxsize)
- * fh must be initialized before calling fh_compose
- */
- fh_init(&fh, maxsize);
-- if (fh_compose(&fh, exp, nd.path.dentry, NULL))
-+ if (fh_compose(&fh, exp, nd.dentry, NULL))
- err = -EINVAL;
- else
- err = 0;
-@@ -1203,7 +1205,7 @@ exp_rootfh(svc_client *clp, char *path, struct knfsd_fh *f, int maxsize)
- fh_put(&fh);
- exp_put(exp);
- out:
-- path_put(&nd.path);
-+ backport_path_put(&nd);
- return err;
- }
-
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c
-index 145b3c8..ad22c29 100644
+index 5275097..fd193b6 100644
--- a/fs/nfsd/nfs4recover.c
+++ b/fs/nfsd/nfs4recover.c
-@@ -121,9 +121,9 @@ out_no_tfm:
+@@ -54,26 +54,20 @@
+ static struct path rec_dir;
+ static int rec_dir_init = 0;
+
+-static int
+-nfs4_save_creds(const struct cred **original_creds)
++static void
++nfs4_save_user(uid_t *saveuid, gid_t *savegid)
+ {
+- struct cred *new;
+-
+- new = prepare_creds();
+- if (!new)
+- return -ENOMEM;
+-
+- new->fsuid = 0;
+- new->fsgid = 0;
+- *original_creds = override_creds(new);
+- put_cred(new);
+- return 0;
++ *saveuid = current->fsuid;
++ *savegid = current->fsgid;
++ current->fsuid = 0;
++ current->fsgid = 0;
+ }
+
static void
- nfsd4_sync_rec_dir(void)
- {
-- mutex_lock(&rec_dir.path.dentry->d_inode->i_mutex);
-- nfsd_sync_dir(rec_dir.path.dentry);
-- mutex_unlock(&rec_dir.path.dentry->d_inode->i_mutex);
-+ mutex_lock(&rec_dir.dentry->d_inode->i_mutex);
-+ nfsd_sync_dir(rec_dir.dentry);
-+ mutex_unlock(&rec_dir.dentry->d_inode->i_mutex);
+-nfs4_reset_creds(const struct cred *original)
++nfs4_reset_user(uid_t saveuid, gid_t savegid)
+ {
+- revert_creds(original);
++ current->fsuid = saveuid;
++ current->fsgid = savegid;
}
+ static void
+@@ -135,7 +129,8 @@ nfsd4_sync_rec_dir(void)
int
-@@ -143,9 +143,9 @@ nfsd4_create_clid_dir(struct nfs4_client *clp)
- nfs4_save_user(&uid, &gid);
+ nfsd4_create_clid_dir(struct nfs4_client *clp)
+ {
+- const struct cred *original_cred;
++ uid_t uid;
++ gid_t gid;
+ char *dname = clp->cl_recdir;
+ struct dentry *dentry;
+ int status;
+@@ -145,9 +140,7 @@ nfsd4_create_clid_dir(struct nfs4_client *clp)
+ if (!rec_dir_init || clp->cl_firststate)
+ return 0;
+
+- status = nfs4_save_creds(&original_cred);
+- if (status < 0)
+- return status;
++ nfs4_save_user(&uid, &gid);
/* lock the parent */
-- mutex_lock(&rec_dir.path.dentry->d_inode->i_mutex);
-+ mutex_lock(&rec_dir.dentry->d_inode->i_mutex);
-
-- dentry = lookup_one_len(dname, rec_dir.path.dentry, HEXDIR_LEN-1);
-+ dentry = lookup_one_len(dname, rec_dir.dentry, HEXDIR_LEN-1);
- if (IS_ERR(dentry)) {
- status = PTR_ERR(dentry);
- goto out_unlock;
-@@ -155,15 +155,15 @@ nfsd4_create_clid_dir(struct nfs4_client *clp)
- dprintk("NFSD: nfsd4_create_clid_dir: DIRECTORY EXISTS\n");
- goto out_put;
- }
-- status = mnt_want_write(rec_dir.path.mnt);
-+ status = mnt_want_write(rec_dir.mnt);
- if (status)
- goto out_put;
-- status = vfs_mkdir(rec_dir.path.dentry->d_inode, dentry, S_IRWXU);
-- mnt_drop_write(rec_dir.path.mnt);
-+ status = vfs_mkdir(rec_dir.dentry->d_inode, dentry, S_IRWXU);
-+ mnt_drop_write(rec_dir.mnt);
- out_put:
- dput(dentry);
- out_unlock:
-- mutex_unlock(&rec_dir.path.dentry->d_inode->i_mutex);
-+ mutex_unlock(&rec_dir.dentry->d_inode->i_mutex);
- if (status == 0) {
+ mutex_lock(&rec_dir.dentry->d_inode->i_mutex);
+@@ -175,7 +168,7 @@ out_unlock:
clp->cl_firststate = 1;
nfsd4_sync_rec_dir();
-@@ -226,7 +226,7 @@ nfsd4_list_rec_dir(struct dentry *dir, recdir_func *f)
+ }
+- nfs4_reset_creds(original_cred);
++ nfs4_reset_user(uid, gid);
+ dprintk("NFSD: nfsd4_create_clid_dir returns %d\n", status);
+ return status;
+ }
+@@ -208,7 +201,8 @@ nfsd4_build_namelist(void *arg, const char *name, int namlen,
+ static int
+ nfsd4_list_rec_dir(struct dentry *dir, recdir_func *f)
+ {
+- const struct cred *original_cred;
++ uid_t uid;
++ gid_t gid;
+ struct file *filp;
+ LIST_HEAD(names);
+ struct name_list *entry;
+@@ -218,12 +212,9 @@ nfsd4_list_rec_dir(struct dentry *dir, recdir_func *f)
+ if (!rec_dir_init)
+ return 0;
- nfs4_save_user(&uid, &gid);
+- status = nfs4_save_creds(&original_cred);
+- if (status < 0)
+- return status;
++ nfs4_save_user(&uid, &gid);
-- filp = dentry_open(dget(dir), mntget(rec_dir.path.mnt), O_RDONLY);
+- filp = dentry_open(dget(dir), mntget(rec_dir.mnt), O_RDONLY,
+- current_cred());
+ filp = dentry_open(dget(dir), mntget(rec_dir.mnt), O_RDONLY);
status = PTR_ERR(filp);
if (IS_ERR(filp))
goto out;
-@@ -291,9 +291,9 @@ nfsd4_unlink_clid_dir(char *name, int namlen)
-
- dprintk("NFSD: nfsd4_unlink_clid_dir. name %.*s\n", namlen, name);
-
-- mutex_lock(&rec_dir.path.dentry->d_inode->i_mutex);
-- dentry = lookup_one_len(name, rec_dir.path.dentry, namlen);
-- mutex_unlock(&rec_dir.path.dentry->d_inode->i_mutex);
-+ mutex_lock(&rec_dir.dentry->d_inode->i_mutex);
-+ dentry = lookup_one_len(name, rec_dir.dentry, namlen);
-+ mutex_unlock(&rec_dir.dentry->d_inode->i_mutex);
- if (IS_ERR(dentry)) {
- status = PTR_ERR(dentry);
- return status;
-@@ -302,7 +302,7 @@ nfsd4_unlink_clid_dir(char *name, int namlen)
- if (!dentry->d_inode)
- goto out;
-
-- status = nfsd4_clear_clid_dir(rec_dir.path.dentry, dentry);
-+ status = nfsd4_clear_clid_dir(rec_dir.dentry, dentry);
- out:
- dput(dentry);
+@@ -252,7 +243,7 @@ out:
+ list_del(&entry->list);
+ kfree(entry);
+ }
+- nfs4_reset_creds(original_cred);
++ nfs4_reset_user(uid, gid);
return status;
-@@ -318,7 +318,7 @@ nfsd4_remove_clid_dir(struct nfs4_client *clp)
- if (!rec_dir_init || !clp->cl_firststate)
- return;
+ }
+
+@@ -284,7 +275,8 @@ out_unlock:
+ void
+ nfsd4_remove_clid_dir(struct nfs4_client *clp)
+ {
+- const struct cred *original_cred;
++ uid_t uid;
++ gid_t gid;
+ int status;
-- status = mnt_want_write(rec_dir.path.mnt);
-+ status = mnt_want_write(rec_dir.mnt);
- if (status)
+ if (!rec_dir_init || !clp->cl_firststate)
+@@ -295,12 +287,10 @@ nfsd4_remove_clid_dir(struct nfs4_client *clp)
goto out;
clp->cl_firststate = 0;
-@@ -327,7 +327,7 @@ nfsd4_remove_clid_dir(struct nfs4_client *clp)
- nfs4_reset_user(uid, gid);
- if (status == 0)
- nfsd4_sync_rec_dir();
-- mnt_drop_write(rec_dir.path.mnt);
-+ mnt_drop_write(rec_dir.mnt);
- out:
- if (status)
- printk("NFSD: Failed to remove expired client state directory"
-@@ -357,17 +357,17 @@ nfsd4_recdir_purge_old(void) {
- if (!rec_dir_init)
- return;
-- status = mnt_want_write(rec_dir.path.mnt);
-+ status = mnt_want_write(rec_dir.mnt);
- if (status)
- goto out;
-- status = nfsd4_list_rec_dir(rec_dir.path.dentry, purge_old);
-+ status = nfsd4_list_rec_dir(rec_dir.dentry, purge_old);
+- status = nfs4_save_creds(&original_cred);
+- if (status < 0)
+- goto out;
++ nfs4_save_user(&uid, &gid);
+
+ status = nfsd4_unlink_clid_dir(clp->cl_recdir, HEXDIR_LEN-1);
+- nfs4_reset_creds(original_cred);
++ nfs4_reset_user(uid, gid);
if (status == 0)
nfsd4_sync_rec_dir();
-- mnt_drop_write(rec_dir.path.mnt);
-+ mnt_drop_write(rec_dir.mnt);
- out:
- if (status)
- printk("nfsd4: failed to purge old clients from recovery"
-- " directory %s\n", rec_dir.path.dentry->d_name.name);
-+ " directory %s\n", rec_dir.dentry->d_name.name);
- }
-
- static int
-@@ -387,10 +387,10 @@ int
- nfsd4_recdir_load(void) {
+ mnt_drop_write(rec_dir.mnt);
+@@ -378,7 +368,8 @@ nfsd4_recdir_load(void) {
+ void
+ nfsd4_init_recdir(char *rec_dirname)
+ {
+- const struct cred *original_cred;
++ uid_t uid;
++ gid_t gid;
int status;
-- status = nfsd4_list_rec_dir(rec_dir.path.dentry, load_recdir);
-+ status = nfsd4_list_rec_dir(rec_dir.dentry, load_recdir);
- if (status)
- printk("nfsd4: failed loading clients from recovery"
-- " directory %s\n", rec_dir.path.dentry->d_name.name);
-+ " directory %s\n", rec_dir.dentry->d_name.name);
- return status;
- }
+ printk("NFSD: Using %s as the NFSv4 state recovery directory\n",
+@@ -386,13 +377,7 @@ nfsd4_init_recdir(char *rec_dirname)
-@@ -429,5 +429,5 @@ nfsd4_shutdown_recdir(void)
- if (!rec_dir_init)
- return;
- rec_dir_init = 0;
-- path_put(&rec_dir.path);
-+ backport_path_put(&rec_dir);
+ BUG_ON(rec_dir_init);
+
+- status = nfs4_save_creds(&original_cred);
+- if (status < 0) {
+- printk("NFSD: Unable to change credentials to find recovery"
+- " directory: error %d\n",
+- status);
+- return;
+- }
++ nfs4_save_user(&uid, &gid);
+
+ status = kern_path(rec_dirname, LOOKUP_FOLLOW | LOOKUP_DIRECTORY,
+ &rec_dir);
+@@ -402,7 +387,7 @@ nfsd4_init_recdir(char *rec_dirname)
+
+ if (!status)
+ rec_dir_init = 1;
+- nfs4_reset_creds(original_cred);
++ nfs4_reset_user(uid, gid);
}
+
+ void
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
-index 1578d7a..1c6df07 100644
+index c65a27b..436bc25 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
-@@ -1576,7 +1576,7 @@ static __be32
+@@ -1552,7 +1552,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
+ status = nfserr_clid_inuse;
+ if (!same_creds(&conf->cl_cred, &rqstp->rq_cred)) {
+ dprintk("NFSD: setclientid: string in use by client"
+- " at %pI4\n", &conf->cl_addr);
++ " at "NIPQUAD_FMT"\n", NIPQUAD(conf->cl_addr));
+ goto out;
+ }
+ }
+@@ -2376,7 +2376,7 @@ static __be32
nfs4_upgrade_open(struct svc_rqst *rqstp, struct svc_fh *cur_fh, struct nfs4_stateid *stp, struct nfsd4_open *open)
{
struct file *filp = stp->st_vfs_file;
@@ -1583,7 +1738,7 @@ index 1578d7a..1c6df07 100644
unsigned int share_access, new_writer;
__be32 status;
-@@ -1923,7 +1923,7 @@ search_close_lru(u32 st_id, int flags)
+@@ -2733,7 +2733,7 @@ search_close_lru(u32 st_id, int flags)
static inline int
nfs4_check_fh(struct svc_fh *fhp, struct nfs4_stateid *stp)
{
@@ -1592,16 +1747,7 @@ index 1578d7a..1c6df07 100644
}
static int
-@@ -2838,7 +2838,7 @@ nfsd4_lockt(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
- * only the dentry:inode set.
- */
- memset(&file, 0, sizeof (struct file));
-- file.f_path.dentry = cstate->current_fh.fh_dentry;
-+ file.f_dentry = cstate->current_fh.fh_dentry;
-
- status = nfs_ok;
- error = vfs_test_lock(&file, &file_lock);
-@@ -2934,7 +2934,7 @@ static int
+@@ -3804,7 +3804,7 @@ static int
check_for_locks(struct file *filp, struct nfs4_stateowner *lowner)
{
struct file_lock **flpp;
@@ -1610,22 +1756,24 @@ index 1578d7a..1c6df07 100644
int status = 0;
lock_kernel();
-@@ -3294,11 +3294,11 @@ nfs4_reset_recoverydir(char *recdir)
- if (status)
- return status;
- status = -ENOTDIR;
-- if (S_ISDIR(nd.path.dentry->d_inode->i_mode)) {
-+ if (S_ISDIR(nd.dentry->d_inode->i_mode)) {
- nfs4_set_recdir(recdir);
- status = 0;
- }
-- path_put(&nd.path);
-+ backport_path_put(&nd);
- return status;
- }
-
+diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
+index b820c31..c8a317c 100644
+--- a/fs/nfsd/nfs4xdr.c
++++ b/fs/nfsd/nfs4xdr.c
+@@ -2956,9 +2956,9 @@ nfsd4_encode_exchange_id(struct nfsd4_compoundres *resp, int nfserr,
+ if (nfserr)
+ return nfserr;
+
+- major_id = utsname()->nodename;
++ major_id = system_utsname.nodename;
+ major_id_sz = strlen(major_id);
+- server_scope = utsname()->nodename;
++ server_scope = system_utsname.nodename;
+ server_scope_sz = strlen(server_scope);
+
+ RESERVE_SPACE(
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c
-index c53e65f..fc2871b 100644
+index af16849..b61f3b4 100644
--- a/fs/nfsd/nfsctl.c
+++ b/fs/nfsd/nfsctl.c
@@ -121,7 +121,7 @@ static ssize_t (*write_op[])(struct file *, char *, size_t) = {
@@ -1633,45 +1781,62 @@ index c53e65f..fc2871b 100644
static ssize_t nfsctl_transaction_write(struct file *file, const char __user *buf, size_t size, loff_t *pos)
{
- ino_t ino = file->f_path.dentry->d_inode->i_ino;
-+ ino_t ino = file->f_dentry->d_inode->i_ino;
++ ino_t ino = file->f_dentry->d_inode->i_ino;
char *data;
ssize_t rv;
-@@ -360,9 +360,9 @@ static ssize_t failover_unlock_fs(struct file *file, char *buf, size_t size)
- if (error)
- return error;
-
-- error = nlmsvc_unlock_all_by_sb(nd.path.mnt->mnt_sb);
-+ error = nlmsvc_unlock_all_by_sb(nd.mnt->mnt_sb);
-
-- path_put(&nd.path);
-+ backport_path_put(&nd);
- return error;
- }
-
-diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c
-index 80292ff..47eb160 100644
---- a/fs/nfsd/nfssvc.c
-+++ b/fs/nfsd/nfssvc.c
-@@ -574,3 +574,5 @@ nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp)
- nfsd_cache_update(rqstp, proc->pc_cachetype, statp + 1);
- return 1;
- }
-+
-+MODULE_LICENSE("Dual BSD/GPL");
+diff --git a/fs/nfsd/nfsfh.c b/fs/nfsd/nfsfh.c
+index 9f1ca17..3702de6 100644
+--- a/fs/nfsd/nfsfh.c
++++ b/fs/nfsd/nfsfh.c
+@@ -186,14 +186,9 @@ static __be32 nfsd_set_fh_dentry(struct svc_rqst *rqstp, struct svc_fh *fhp)
+ * access control settings being in effect, we cannot
+ * fix that case easily.
+ */
+- struct cred *new = prepare_creds();
+- if (!new)
+- return nfserrno(-ENOMEM);
+- new->cap_effective =
+- cap_raise_nfsd_set(new->cap_effective,
+- new->cap_permitted);
+- put_cred(override_creds(new));
+- put_cred(new);
++ current->cap_effective =
++ cap_raise_nfsd_set(current->cap_effective,
++ current->cap_permitted);
+ } else {
+ error = nfsd_setuser_and_check_port(rqstp, exp);
+ if (error)
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
-index 18060be..becacce 100644
+index 6c68ffd..8c026d5 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
-@@ -23,7 +23,6 @@
- #include <linux/file.h>
- #include <linux/mount.h>
- #include <linux/major.h>
--#include <linux/splice.h>
- #include <linux/proc_fs.h>
- #include <linux/stat.h>
- #include <linux/fcntl.h>
-@@ -766,10 +765,10 @@ static int
+@@ -55,6 +55,7 @@
+ #include <linux/security.h>
+ #endif /* CONFIG_NFSD_V4 */
+ #include <linux/jhash.h>
++#include <linux/cred.h>
+
+ #include <asm/uaccess.h>
+
+@@ -677,7 +678,6 @@ __be32
+ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
+ int access, struct file **filp)
+ {
+- const struct cred *cred = current_cred();
+ struct dentry *dentry;
+ struct inode *inode;
+ int flags = O_RDONLY|O_LARGEFILE;
+@@ -732,7 +732,7 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
+ vfs_dq_init(inode);
+ }
+ *filp = dentry_open(dget(dentry), mntget(fhp->fh_export->ex_path.mnt),
+- flags, cred);
++ flags);
+ if (IS_ERR(*filp))
+ host_err = PTR_ERR(*filp);
+ out_nfserr:
+@@ -775,10 +775,10 @@ static int
nfsd_sync(struct file *filp)
{
int err;
@@ -1685,19 +1850,13 @@ index 18060be..becacce 100644
mutex_unlock(&inode->i_mutex);
return err;
-@@ -828,53 +827,39 @@ found:
- return ra;
- }
-
--/*
-- * Grab and keep cached pages associated with a file in the svc_rqst
-- * so that they can be passed to the network sendmsg/sendpage routines
-- * directly. They will be released after the sending has completed.
-- */
+@@ -843,47 +843,38 @@ found:
+ * directly. They will be released after the sending has completed.
+ */
static int
-nfsd_splice_actor(struct pipe_inode_info *pipe, struct pipe_buffer *buf,
- struct splice_desc *sd)
-+nfsd_read_actor(read_descriptor_t *desc, struct page *page, unsigned long offset , unsigned long size)
++nfsd_read_actor(read_descriptor_t *desc, struct page *page, unsigned long offset, unsigned long size)
{
- struct svc_rqst *rqstp = sd->u.data;
+ unsigned long count = desc->count;
@@ -1754,7 +1913,7 @@ index 18060be..becacce 100644
static inline int svc_msnfs(struct svc_fh *ffhp)
{
#ifdef MSNFS
-@@ -895,7 +880,7 @@ nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
+@@ -904,7 +895,7 @@ nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
int host_err;
err = nfserr_perm;
@@ -1763,7 +1922,7 @@ index 18060be..becacce 100644
if (svc_msnfs(fhp) && !lock_may_read(inode, offset, *count))
goto out;
-@@ -906,16 +891,9 @@ nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
+@@ -915,16 +906,9 @@ nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
if (ra && ra->p_set)
file->f_ra = ra->p_ra;
@@ -1782,7 +1941,7 @@ index 18060be..becacce 100644
} else {
oldfs = get_fs();
set_fs(KERNEL_DS);
-@@ -937,7 +915,7 @@ nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
+@@ -946,7 +930,7 @@ nfsd_vfs_read(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
nfsdstats.io_read += host_err;
*count = host_err;
err = 0;
@@ -1791,12 +1950,12 @@ index 18060be..becacce 100644
} else
err = nfserrno(host_err);
out:
-@@ -971,11 +949,11 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
+@@ -980,11 +964,11 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
err = nfserr_perm;
if ((fhp->fh_export->ex_flags & NFSEXP_MSNFS) &&
-- (!lock_may_write(file->f_path.dentry->d_inode, offset, cnt)))
-+ (!lock_may_write(file->f_dentry->d_inode, offset, cnt)))
+- (!lock_may_write(file->f_path.dentry->d_inode, offset, *cnt)))
++ (!lock_may_write(file->f_dentry->d_inode, offset, *cnt)))
goto out;
#endif
@@ -1805,20 +1964,39 @@ index 18060be..becacce 100644
inode = dentry->d_inode;
exp = fhp->fh_export;
-@@ -1004,7 +982,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
+@@ -1005,9 +989,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
+ if (!EX_ISSYNC(exp))
+ stable = 0;
+ if (stable && !EX_WGATHER(exp)) {
+- spin_lock(&file->f_lock);
+ file->f_flags |= O_SYNC;
+- spin_unlock(&file->f_lock);
+ }
+
+ /* Write the data. */
+@@ -1016,7 +998,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file,
set_fs(oldfs);
if (host_err >= 0) {
- nfsdstats.io_write += cnt;
+ nfsdstats.io_write += host_err;
- fsnotify_modify(file->f_path.dentry);
+ fsnotify_modify(file->f_dentry);
}
/* clear setuid/setgid flag after write */
+@@ -1906,7 +1888,7 @@ static __be32 nfsd_buffered_readdir(struct file *file, filldir_t func,
+ offset = *offsetp;
+
+ while (1) {
+- struct inode *dir_inode = file->f_path.dentry->d_inode;
++ struct inode *dir_inode = file->f_dentry->d_inode;
+ unsigned int reclen;
+
+ cdp->err = nfserr_eof; /* will be cleared on successful read */
diff --git a/include/linux/exportfs.h b/include/linux/exportfs.h
-index 27e772c..d932fb1 100644
+index 27e772c..ad9a829 100644
--- a/include/linux/exportfs.h
+++ b/include/linux/exportfs.h
-@@ -89,85 +89,9 @@ struct fid {
+@@ -89,85 +89,10 @@ struct fid {
};
};
@@ -1892,7 +2070,7 @@ index 27e772c..d932fb1 100644
extern struct dentry *exportfs_decode_fh(struct vfsmount *mnt, struct fid *fid,
int fh_len, int fileid_type, int (*acceptable)(void *, struct dentry *),
void *context);
--
+
-/*
- * Generic helpers for filesystems.
- */
@@ -1905,10 +2083,10 @@ index 27e772c..d932fb1 100644
-
#endif /* LINUX_EXPORTFS_H */
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
-index dbb87ab..9236e80 100644
+index 51855df..2142bf0 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
-@@ -230,7 +230,7 @@ int nlmsvc_unlock_all_by_ip(struct sockaddr *server_addr);
+@@ -285,7 +285,7 @@ int nlmsvc_unlock_all_by_ip(struct sockaddr *server_addr);
static inline struct inode *nlmsvc_file_inode(struct nlm_file *file)
{
@@ -1916,20 +2094,65 @@ index dbb87ab..9236e80 100644
+ return file->f_file->f_dentry->d_inode;
}
- /*
+ static inline int __nlm_privileged_request4(const struct sockaddr *sap)
+diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h
+index d39ed1c..7dc5b6c 100644
+--- a/include/linux/lockd/xdr.h
++++ b/include/linux/lockd/xdr.h
+@@ -25,13 +25,13 @@ struct svc_rqst;
+ #define NLM_MAXCOOKIELEN 32
+ #define NLM_MAXSTRLEN 1024
+
+-#define nlm_granted cpu_to_be32(NLM_LCK_GRANTED)
+-#define nlm_lck_denied cpu_to_be32(NLM_LCK_DENIED)
+-#define nlm_lck_denied_nolocks cpu_to_be32(NLM_LCK_DENIED_NOLOCKS)
+-#define nlm_lck_blocked cpu_to_be32(NLM_LCK_BLOCKED)
+-#define nlm_lck_denied_grace_period cpu_to_be32(NLM_LCK_DENIED_GRACE_PERIOD)
++#define nlm_granted __constant_htonl(NLM_LCK_GRANTED)
++#define nlm_lck_denied __constant_htonl(NLM_LCK_DENIED)
++#define nlm_lck_denied_nolocks __constant_htonl(NLM_LCK_DENIED_NOLOCKS)
++#define nlm_lck_blocked __constant_htonl(NLM_LCK_BLOCKED)
++#define nlm_lck_denied_grace_period __constant_htonl(NLM_LCK_DENIED_GRACE_PERIOD)
+
+-#define nlm_drop_reply cpu_to_be32(30000)
++#define nlm_drop_reply __constant_htonl(30000)
+
+ /* Lock info passed via NLM */
+ struct nlm_lock {
+diff --git a/include/linux/lockd/xdr4.h b/include/linux/lockd/xdr4.h
+index 7353821..12bfe09 100644
+--- a/include/linux/lockd/xdr4.h
++++ b/include/linux/lockd/xdr4.h
+@@ -15,11 +15,11 @@
+ #include <linux/lockd/xdr.h>
+
+ /* error codes new to NLMv4 */
+-#define nlm4_deadlock cpu_to_be32(NLM_DEADLCK)
+-#define nlm4_rofs cpu_to_be32(NLM_ROFS)
+-#define nlm4_stale_fh cpu_to_be32(NLM_STALE_FH)
+-#define nlm4_fbig cpu_to_be32(NLM_FBIG)
+-#define nlm4_failed cpu_to_be32(NLM_FAILED)
++#define nlm4_deadlock __constant_htonl(NLM_DEADLCK)
++#define nlm4_rofs __constant_htonl(NLM_ROFS)
++#define nlm4_stale_fh __constant_htonl(NLM_STALE_FH)
++#define nlm4_fbig __constant_htonl(NLM_FBIG)
++#define nlm4_failed __constant_htonl(NLM_FAILED)
+
+
+
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
-index 78a5922..e59d828 100644
+index fdffb41..a41d1a5 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
-@@ -9,6 +9,7 @@
- #ifndef _LINUX_NFS_FS_H
+@@ -10,6 +10,7 @@
#define _LINUX_NFS_FS_H
-+#include <linux/path.h>
#include <linux/magic.h>
++#include <linux/path.h>
/* Default timeout values */
-@@ -331,7 +332,7 @@ extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *);
+ #define NFS_DEF_UDP_TIMEO (11)
+@@ -343,7 +344,7 @@ extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *);
extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr);
extern int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr);
extern int nfs_getattr(struct vfsmount *, struct dentry *, struct kstat *);
@@ -1938,7 +2161,7 @@ index 78a5922..e59d828 100644
extern int nfs_open(struct inode *, struct file *);
extern int nfs_release(struct inode *, struct file *);
extern int nfs_attribute_timeout(struct inode *inode);
-@@ -358,9 +359,9 @@ static inline void nfs_fattr_init(struct nfs_fattr *fattr)
+@@ -366,9 +367,9 @@ extern unsigned long nfs_inc_attr_generation_counter(void);
/*
* linux/fs/nfs/file.c
*/
@@ -1950,7 +2173,7 @@ index 78a5922..e59d828 100644
#endif /* CONFIG_NFS_V3 */
extern const struct file_operations nfs_file_operations;
extern const struct address_space_operations nfs_file_aops;
-@@ -408,9 +409,9 @@ extern ssize_t nfs_file_direct_write(struct kiocb *iocb,
+@@ -420,12 +421,12 @@ extern ssize_t nfs_file_direct_write(struct kiocb *iocb,
/*
* linux/fs/nfs/dir.c
*/
@@ -1961,8 +2184,12 @@ index 78a5922..e59d828 100644
+extern struct inode_operations nfs3_dir_inode_operations;
#endif /* CONFIG_NFS_V3 */
extern const struct file_operations nfs_dir_operations;
- extern struct dentry_operations nfs_dentry_operations;
-@@ -423,7 +424,7 @@ extern void nfs_access_zap_cache(struct inode *inode);
+-extern const struct dentry_operations nfs_dentry_operations;
++extern struct dentry_operations nfs_dentry_operations;
+
+ extern void nfs_force_lookup_revalidate(struct inode *dir);
+ extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr);
+@@ -435,7 +436,7 @@ extern void nfs_access_zap_cache(struct inode *inode);
/*
* linux/fs/nfs/symlink.c
*/
@@ -1971,7 +2198,7 @@ index 78a5922..e59d828 100644
/*
* linux/fs/nfs/sysctl.c
-@@ -439,8 +440,8 @@ extern void nfs_unregister_sysctl(void);
+@@ -451,8 +452,8 @@ extern void nfs_unregister_sysctl(void);
/*
* linux/fs/nfs/namespace.c
*/
@@ -1983,299 +2210,327 @@ index 78a5922..e59d828 100644
extern void nfs_release_automount_timer(void);
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
-index 8c77c11..d9007dc 100644
+index b89c34e..4303536 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
-@@ -782,8 +782,8 @@ struct nfs_access_entry;
+@@ -817,9 +817,9 @@ struct nfs_access_entry;
+ */
struct nfs_rpc_ops {
u32 version; /* Protocol version */
- struct dentry_operations *dentry_ops;
+- const struct dentry_operations *dentry_ops;
- const struct inode_operations *dir_inode_ops;
- const struct inode_operations *file_inode_ops;
++ struct dentry_operations *dentry_ops;
+ struct inode_operations *dir_inode_ops;
+ struct inode_operations *file_inode_ops;
int (*getroot) (struct nfs_server *, struct nfs_fh *,
struct nfs_fsinfo *);
diff --git a/include/linux/nfsd/export.h b/include/linux/nfsd/export.h
-index 5431512..3753e4b 100644
+index bcd0201..fc59b1d 100644
--- a/include/linux/nfsd/export.h
+++ b/include/linux/nfsd/export.h
-@@ -15,6 +15,7 @@
+@@ -11,6 +11,7 @@
+ #define NFSD_EXPORT_H
+
# include <linux/types.h>
++# include <linux/path.h>
+ #ifdef __KERNEL__
# include <linux/in.h>
#endif
-+#include <linux/path.h>
-
+diff --git a/include/linux/nfsd/nfsd.h b/include/linux/nfsd/nfsd.h
+index 2b49d67..490ea85 100644
+--- a/include/linux/nfsd/nfsd.h
++++ b/include/linux/nfsd/nfsd.h
+@@ -188,119 +188,119 @@ void nfsd_lockd_shutdown(void);
/*
- * Important limits for the exports stuff.
-diff --git a/include/linux/pipe_fs_i.h b/include/linux/pipe_fs_i.h
-deleted file mode 100644
-index 8e41202..0000000
---- a/include/linux/pipe_fs_i.h
-+++ /dev/null
-@@ -1,151 +0,0 @@
--#ifndef _LINUX_PIPE_FS_I_H
--#define _LINUX_PIPE_FS_I_H
--
--#define PIPEFS_MAGIC 0x50495045
--
--#define PIPE_BUFFERS (16)
--
--#define PIPE_BUF_FLAG_LRU 0x01 /* page is on the LRU */
--#define PIPE_BUF_FLAG_ATOMIC 0x02 /* was atomically mapped */
--#define PIPE_BUF_FLAG_GIFT 0x04 /* page is a gift */
--
--/**
-- * struct pipe_buffer - a linux kernel pipe buffer
-- * @page: the page containing the data for the pipe buffer
-- * @offset: offset of data inside the @page
-- * @len: length of data inside the @page
-- * @ops: operations associated with this buffer. See @pipe_buf_operations.
-- * @flags: pipe buffer flags. See above.
-- * @private: private data owned by the ops.
-- **/
--struct pipe_buffer {
-- struct page *page;
-- unsigned int offset, len;
-- const struct pipe_buf_operations *ops;
-- unsigned int flags;
-- unsigned long private;
--};
--
--/**
-- * struct pipe_inode_info - a linux kernel pipe
-- * @wait: reader/writer wait point in case of empty/full pipe
-- * @nrbufs: the number of non-empty pipe buffers in this pipe
-- * @curbuf: the current pipe buffer entry
-- * @tmp_page: cached released page
-- * @readers: number of current readers of this pipe
-- * @writers: number of current writers of this pipe
-- * @waiting_writers: number of writers blocked waiting for room
-- * @r_counter: reader counter
-- * @w_counter: writer counter
-- * @fasync_readers: reader side fasync
-- * @fasync_writers: writer side fasync
-- * @inode: inode this pipe is attached to
-- * @bufs: the circular array of pipe buffers
-- **/
--struct pipe_inode_info {
-- wait_queue_head_t wait;
-- unsigned int nrbufs, curbuf;
-- struct page *tmp_page;
-- unsigned int readers;
-- unsigned int writers;
-- unsigned int waiting_writers;
-- unsigned int r_counter;
-- unsigned int w_counter;
-- struct fasync_struct *fasync_readers;
-- struct fasync_struct *fasync_writers;
-- struct inode *inode;
-- struct pipe_buffer bufs[PIPE_BUFFERS];
--};
--
--/*
-- * Note on the nesting of these functions:
-- *
-- * ->confirm()
-- * ->steal()
-- * ...
-- * ->map()
-- * ...
-- * ->unmap()
-- *
-- * That is, ->map() must be called on a confirmed buffer,
-- * same goes for ->steal(). See below for the meaning of each
-- * operation. Also see kerneldoc in fs/pipe.c for the pipe
-- * and generic variants of these hooks.
-- */
--struct pipe_buf_operations {
-- /*
-- * This is set to 1, if the generic pipe read/write may coalesce
-- * data into an existing buffer. If this is set to 0, a new pipe
-- * page segment is always used for new data.
-- */
-- int can_merge;
--
-- /*
-- * ->map() returns a virtual address mapping of the pipe buffer.
-- * The last integer flag reflects whether this should be an atomic
-- * mapping or not. The atomic map is faster, however you can't take
-- * page faults before calling ->unmap() again. So if you need to eg
-- * access user data through copy_to/from_user(), then you must get
-- * a non-atomic map. ->map() uses the KM_USER0 atomic slot for
-- * atomic maps, so you can't map more than one pipe_buffer at once
-- * and you have to be careful if mapping another page as source
-- * or destination for a copy (IOW, it has to use something else
-- * than KM_USER0).
-- */
-- void * (*map)(struct pipe_inode_info *, struct pipe_buffer *, int);
--
-- /*
-- * Undoes ->map(), finishes the virtual mapping of the pipe buffer.
-- */
-- void (*unmap)(struct pipe_inode_info *, struct pipe_buffer *, void *);
--
-- /*
-- * ->confirm() verifies that the data in the pipe buffer is there
-- * and that the contents are good. If the pages in the pipe belong
-- * to a file system, we may need to wait for IO completion in this
-- * hook. Returns 0 for good, or a negative error value in case of
-- * error.
-- */
-- int (*confirm)(struct pipe_inode_info *, struct pipe_buffer *);
--
-- /*
-- * When the contents of this pipe buffer has been completely
-- * consumed by a reader, ->release() is called.
-- */
-- void (*release)(struct pipe_inode_info *, struct pipe_buffer *);
--
-- /*
-- * Attempt to take ownership of the pipe buffer and its contents.
-- * ->steal() returns 0 for success, in which case the contents
-- * of the pipe (the buf->page) is locked and now completely owned
-- * by the caller. The page may then be transferred to a different
-- * mapping, the most often used case is insertion into different
-- * file address space cache.
-- */
-- int (*steal)(struct pipe_inode_info *, struct pipe_buffer *);
--
-- /*
-- * Get a reference to the pipe buffer.
-- */
-- void (*get)(struct pipe_inode_info *, struct pipe_buffer *);
--};
--
--/* Differs from PIPE_BUF in that PIPE_SIZE is the length of the actual
-- memory allocation, whereas PIPE_BUF makes atomicity guarantees. */
--#define PIPE_SIZE PAGE_SIZE
--
--/* Drop the inode semaphore and wait for a pipe event, atomically */
--void pipe_wait(struct pipe_inode_info *pipe);
--
--struct pipe_inode_info * alloc_pipe_info(struct inode * inode);
--void free_pipe_info(struct inode * inode);
--void __free_pipe_info(struct pipe_inode_info *);
--
--/* Generic pipe buffer ops functions */
--void *generic_pipe_buf_map(struct pipe_inode_info *, struct pipe_buffer *, int);
--void generic_pipe_buf_unmap(struct pipe_inode_info *, struct pipe_buffer *, void *);
--void generic_pipe_buf_get(struct pipe_inode_info *, struct pipe_buffer *);
--int generic_pipe_buf_confirm(struct pipe_inode_info *, struct pipe_buffer *);
--int generic_pipe_buf_steal(struct pipe_inode_info *, struct pipe_buffer *);
--
--#endif
-diff --git a/include/linux/splice.h b/include/linux/splice.h
-deleted file mode 100644
-index 528dcb9..0000000
---- a/include/linux/splice.h
-+++ /dev/null
-@@ -1,74 +0,0 @@
--/*
-- * Function declerations and data structures related to the splice
-- * implementation.
-- *
-- * Copyright (C) 2007 Jens Axboe <jens.axboe at oracle.com>
-- *
-- */
--#ifndef SPLICE_H
--#define SPLICE_H
--
--#include <linux/pipe_fs_i.h>
--
--/*
-- * splice is tied to pipes as a transport (at least for now), so we'll just
-- * add the splice flags here.
-- */
--#define SPLICE_F_MOVE (0x01) /* move pages instead of copying */
--#define SPLICE_F_NONBLOCK (0x02) /* don't block on the pipe splicing (but */
-- /* we may still block on the fd we splice */
-- /* from/to, of course */
--#define SPLICE_F_MORE (0x04) /* expect more data */
--#define SPLICE_F_GIFT (0x08) /* pages passed in are a gift */
--
--/*
-- * Passed to the actors
-- */
--struct splice_desc {
-- unsigned int len, total_len; /* current and remaining length */
-- unsigned int flags; /* splice flags */
-- /*
-- * actor() private data
-- */
-- union {
-- void __user *userptr; /* memory to write to */
-- struct file *file; /* file to read/write */
-- void *data; /* cookie */
-- } u;
-- loff_t pos; /* file position */
--};
--
--struct partial_page {
-- unsigned int offset;
-- unsigned int len;
-- unsigned long private;
--};
--
--/*
-- * Passed to splice_to_pipe
-- */
--struct splice_pipe_desc {
-- struct page **pages; /* page map */
-- struct partial_page *partial; /* pages[] may not be contig */
-- int nr_pages; /* number of pages in map */
-- unsigned int flags; /* splice flags */
-- const struct pipe_buf_operations *ops;/* ops associated with output pipe */
-- void (*spd_release)(struct splice_pipe_desc *, unsigned int);
--};
--
--typedef int (splice_actor)(struct pipe_inode_info *, struct pipe_buffer *,
-- struct splice_desc *);
--typedef int (splice_direct_actor)(struct pipe_inode_info *,
-- struct splice_desc *);
--
--extern ssize_t splice_from_pipe(struct pipe_inode_info *, struct file *,
-- loff_t *, size_t, unsigned int,
-- splice_actor *);
--extern ssize_t __splice_from_pipe(struct pipe_inode_info *,
-- struct splice_desc *, splice_actor *);
--extern ssize_t splice_to_pipe(struct pipe_inode_info *,
-- struct splice_pipe_desc *);
--extern ssize_t splice_direct_to_actor(struct file *, struct splice_desc *,
-- splice_direct_actor *);
--
--#endif
-diff --git a/include/linux/sunrpc/debug.h b/include/linux/sunrpc/debug.h
-index 10709cb..9bbadbd 100644
---- a/include/linux/sunrpc/debug.h
-+++ b/include/linux/sunrpc/debug.h
-@@ -88,6 +88,7 @@ enum {
- CTL_SLOTTABLE_TCP,
- CTL_MIN_RESVPORT,
- CTL_MAX_RESVPORT,
-+ CTL_TRANSPORT,
- };
-
- #endif /* _LINUX_SUNRPC_DEBUG_H_ */
+ * These macros provide pre-xdr'ed values for faster operation.
+ */
+-#define nfs_ok cpu_to_be32(NFS_OK)
+-#define nfserr_perm cpu_to_be32(NFSERR_PERM)
+-#define nfserr_noent cpu_to_be32(NFSERR_NOENT)
+-#define nfserr_io cpu_to_be32(NFSERR_IO)
+-#define nfserr_nxio cpu_to_be32(NFSERR_NXIO)
+-#define nfserr_eagain cpu_to_be32(NFSERR_EAGAIN)
+-#define nfserr_acces cpu_to_be32(NFSERR_ACCES)
+-#define nfserr_exist cpu_to_be32(NFSERR_EXIST)
+-#define nfserr_xdev cpu_to_be32(NFSERR_XDEV)
+-#define nfserr_nodev cpu_to_be32(NFSERR_NODEV)
+-#define nfserr_notdir cpu_to_be32(NFSERR_NOTDIR)
+-#define nfserr_isdir cpu_to_be32(NFSERR_ISDIR)
+-#define nfserr_inval cpu_to_be32(NFSERR_INVAL)
+-#define nfserr_fbig cpu_to_be32(NFSERR_FBIG)
+-#define nfserr_nospc cpu_to_be32(NFSERR_NOSPC)
+-#define nfserr_rofs cpu_to_be32(NFSERR_ROFS)
+-#define nfserr_mlink cpu_to_be32(NFSERR_MLINK)
+-#define nfserr_opnotsupp cpu_to_be32(NFSERR_OPNOTSUPP)
+-#define nfserr_nametoolong cpu_to_be32(NFSERR_NAMETOOLONG)
+-#define nfserr_notempty cpu_to_be32(NFSERR_NOTEMPTY)
+-#define nfserr_dquot cpu_to_be32(NFSERR_DQUOT)
+-#define nfserr_stale cpu_to_be32(NFSERR_STALE)
+-#define nfserr_remote cpu_to_be32(NFSERR_REMOTE)
+-#define nfserr_wflush cpu_to_be32(NFSERR_WFLUSH)
+-#define nfserr_badhandle cpu_to_be32(NFSERR_BADHANDLE)
+-#define nfserr_notsync cpu_to_be32(NFSERR_NOT_SYNC)
+-#define nfserr_badcookie cpu_to_be32(NFSERR_BAD_COOKIE)
+-#define nfserr_notsupp cpu_to_be32(NFSERR_NOTSUPP)
+-#define nfserr_toosmall cpu_to_be32(NFSERR_TOOSMALL)
+-#define nfserr_serverfault cpu_to_be32(NFSERR_SERVERFAULT)
+-#define nfserr_badtype cpu_to_be32(NFSERR_BADTYPE)
+-#define nfserr_jukebox cpu_to_be32(NFSERR_JUKEBOX)
+-#define nfserr_denied cpu_to_be32(NFSERR_DENIED)
+-#define nfserr_deadlock cpu_to_be32(NFSERR_DEADLOCK)
+-#define nfserr_expired cpu_to_be32(NFSERR_EXPIRED)
+-#define nfserr_bad_cookie cpu_to_be32(NFSERR_BAD_COOKIE)
+-#define nfserr_same cpu_to_be32(NFSERR_SAME)
+-#define nfserr_clid_inuse cpu_to_be32(NFSERR_CLID_INUSE)
+-#define nfserr_stale_clientid cpu_to_be32(NFSERR_STALE_CLIENTID)
+-#define nfserr_resource cpu_to_be32(NFSERR_RESOURCE)
+-#define nfserr_moved cpu_to_be32(NFSERR_MOVED)
+-#define nfserr_nofilehandle cpu_to_be32(NFSERR_NOFILEHANDLE)
+-#define nfserr_minor_vers_mismatch cpu_to_be32(NFSERR_MINOR_VERS_MISMATCH)
+-#define nfserr_share_denied cpu_to_be32(NFSERR_SHARE_DENIED)
+-#define nfserr_stale_stateid cpu_to_be32(NFSERR_STALE_STATEID)
+-#define nfserr_old_stateid cpu_to_be32(NFSERR_OLD_STATEID)
+-#define nfserr_bad_stateid cpu_to_be32(NFSERR_BAD_STATEID)
+-#define nfserr_bad_seqid cpu_to_be32(NFSERR_BAD_SEQID)
+-#define nfserr_symlink cpu_to_be32(NFSERR_SYMLINK)
+-#define nfserr_not_same cpu_to_be32(NFSERR_NOT_SAME)
+-#define nfserr_restorefh cpu_to_be32(NFSERR_RESTOREFH)
+-#define nfserr_attrnotsupp cpu_to_be32(NFSERR_ATTRNOTSUPP)
+-#define nfserr_bad_xdr cpu_to_be32(NFSERR_BAD_XDR)
+-#define nfserr_openmode cpu_to_be32(NFSERR_OPENMODE)
+-#define nfserr_locks_held cpu_to_be32(NFSERR_LOCKS_HELD)
+-#define nfserr_op_illegal cpu_to_be32(NFSERR_OP_ILLEGAL)
+-#define nfserr_grace cpu_to_be32(NFSERR_GRACE)
+-#define nfserr_no_grace cpu_to_be32(NFSERR_NO_GRACE)
+-#define nfserr_reclaim_bad cpu_to_be32(NFSERR_RECLAIM_BAD)
+-#define nfserr_badname cpu_to_be32(NFSERR_BADNAME)
+-#define nfserr_cb_path_down cpu_to_be32(NFSERR_CB_PATH_DOWN)
+-#define nfserr_locked cpu_to_be32(NFSERR_LOCKED)
+-#define nfserr_wrongsec cpu_to_be32(NFSERR_WRONGSEC)
+-#define nfserr_badiomode cpu_to_be32(NFS4ERR_BADIOMODE)
+-#define nfserr_badlayout cpu_to_be32(NFS4ERR_BADLAYOUT)
+-#define nfserr_bad_session_digest cpu_to_be32(NFS4ERR_BAD_SESSION_DIGEST)
+-#define nfserr_badsession cpu_to_be32(NFS4ERR_BADSESSION)
+-#define nfserr_badslot cpu_to_be32(NFS4ERR_BADSLOT)
+-#define nfserr_complete_already cpu_to_be32(NFS4ERR_COMPLETE_ALREADY)
+-#define nfserr_conn_not_bound_to_session cpu_to_be32(NFS4ERR_CONN_NOT_BOUND_TO_SESSION)
+-#define nfserr_deleg_already_wanted cpu_to_be32(NFS4ERR_DELEG_ALREADY_WANTED)
+-#define nfserr_back_chan_busy cpu_to_be32(NFS4ERR_BACK_CHAN_BUSY)
+-#define nfserr_layouttrylater cpu_to_be32(NFS4ERR_LAYOUTTRYLATER)
+-#define nfserr_layoutunavailable cpu_to_be32(NFS4ERR_LAYOUTUNAVAILABLE)
+-#define nfserr_nomatching_layout cpu_to_be32(NFS4ERR_NOMATCHING_LAYOUT)
+-#define nfserr_recallconflict cpu_to_be32(NFS4ERR_RECALLCONFLICT)
+-#define nfserr_unknown_layouttype cpu_to_be32(NFS4ERR_UNKNOWN_LAYOUTTYPE)
+-#define nfserr_seq_misordered cpu_to_be32(NFS4ERR_SEQ_MISORDERED)
+-#define nfserr_sequence_pos cpu_to_be32(NFS4ERR_SEQUENCE_POS)
+-#define nfserr_req_too_big cpu_to_be32(NFS4ERR_REQ_TOO_BIG)
+-#define nfserr_rep_too_big cpu_to_be32(NFS4ERR_REP_TOO_BIG)
+-#define nfserr_rep_too_big_to_cache cpu_to_be32(NFS4ERR_REP_TOO_BIG_TO_CACHE)
+-#define nfserr_retry_uncached_rep cpu_to_be32(NFS4ERR_RETRY_UNCACHED_REP)
+-#define nfserr_unsafe_compound cpu_to_be32(NFS4ERR_UNSAFE_COMPOUND)
+-#define nfserr_too_many_ops cpu_to_be32(NFS4ERR_TOO_MANY_OPS)
+-#define nfserr_op_not_in_session cpu_to_be32(NFS4ERR_OP_NOT_IN_SESSION)
+-#define nfserr_hash_alg_unsupp cpu_to_be32(NFS4ERR_HASH_ALG_UNSUPP)
+-#define nfserr_clientid_busy cpu_to_be32(NFS4ERR_CLIENTID_BUSY)
+-#define nfserr_pnfs_io_hole cpu_to_be32(NFS4ERR_PNFS_IO_HOLE)
+-#define nfserr_seq_false_retry cpu_to_be32(NFS4ERR_SEQ_FALSE_RETRY)
+-#define nfserr_bad_high_slot cpu_to_be32(NFS4ERR_BAD_HIGH_SLOT)
+-#define nfserr_deadsession cpu_to_be32(NFS4ERR_DEADSESSION)
+-#define nfserr_encr_alg_unsupp cpu_to_be32(NFS4ERR_ENCR_ALG_UNSUPP)
+-#define nfserr_pnfs_no_layout cpu_to_be32(NFS4ERR_PNFS_NO_LAYOUT)
+-#define nfserr_not_only_op cpu_to_be32(NFS4ERR_NOT_ONLY_OP)
+-#define nfserr_wrong_cred cpu_to_be32(NFS4ERR_WRONG_CRED)
+-#define nfserr_wrong_type cpu_to_be32(NFS4ERR_WRONG_TYPE)
+-#define nfserr_dirdeleg_unavail cpu_to_be32(NFS4ERR_DIRDELEG_UNAVAIL)
+-#define nfserr_reject_deleg cpu_to_be32(NFS4ERR_REJECT_DELEG)
+-#define nfserr_returnconflict cpu_to_be32(NFS4ERR_RETURNCONFLICT)
+-#define nfserr_deleg_revoked cpu_to_be32(NFS4ERR_DELEG_REVOKED)
++#define nfs_ok __constant_htonl(NFS_OK)
++#define nfserr_perm __constant_htonl(NFSERR_PERM)
++#define nfserr_noent __constant_htonl(NFSERR_NOENT)
++#define nfserr_io __constant_htonl(NFSERR_IO)
++#define nfserr_nxio __constant_htonl(NFSERR_NXIO)
++#define nfserr_eagain __constant_htonl(NFSERR_EAGAIN)
++#define nfserr_acces __constant_htonl(NFSERR_ACCES)
++#define nfserr_exist __constant_htonl(NFSERR_EXIST)
++#define nfserr_xdev __constant_htonl(NFSERR_XDEV)
++#define nfserr_nodev __constant_htonl(NFSERR_NODEV)
++#define nfserr_notdir __constant_htonl(NFSERR_NOTDIR)
++#define nfserr_isdir __constant_htonl(NFSERR_ISDIR)
++#define nfserr_inval __constant_htonl(NFSERR_INVAL)
++#define nfserr_fbig __constant_htonl(NFSERR_FBIG)
++#define nfserr_nospc __constant_htonl(NFSERR_NOSPC)
++#define nfserr_rofs __constant_htonl(NFSERR_ROFS)
++#define nfserr_mlink __constant_htonl(NFSERR_MLINK)
++#define nfserr_opnotsupp __constant_htonl(NFSERR_OPNOTSUPP)
++#define nfserr_nametoolong __constant_htonl(NFSERR_NAMETOOLONG)
++#define nfserr_notempty __constant_htonl(NFSERR_NOTEMPTY)
++#define nfserr_dquot __constant_htonl(NFSERR_DQUOT)
++#define nfserr_stale __constant_htonl(NFSERR_STALE)
++#define nfserr_remote __constant_htonl(NFSERR_REMOTE)
++#define nfserr_wflush __constant_htonl(NFSERR_WFLUSH)
++#define nfserr_badhandle __constant_htonl(NFSERR_BADHANDLE)
++#define nfserr_notsync __constant_htonl(NFSERR_NOT_SYNC)
++#define nfserr_badcookie __constant_htonl(NFSERR_BAD_COOKIE)
++#define nfserr_notsupp __constant_htonl(NFSERR_NOTSUPP)
++#define nfserr_toosmall __constant_htonl(NFSERR_TOOSMALL)
++#define nfserr_serverfault __constant_htonl(NFSERR_SERVERFAULT)
++#define nfserr_badtype __constant_htonl(NFSERR_BADTYPE)
++#define nfserr_jukebox __constant_htonl(NFSERR_JUKEBOX)
++#define nfserr_denied __constant_htonl(NFSERR_DENIED)
++#define nfserr_deadlock __constant_htonl(NFSERR_DEADLOCK)
++#define nfserr_expired __constant_htonl(NFSERR_EXPIRED)
++#define nfserr_bad_cookie __constant_htonl(NFSERR_BAD_COOKIE)
++#define nfserr_same __constant_htonl(NFSERR_SAME)
++#define nfserr_clid_inuse __constant_htonl(NFSERR_CLID_INUSE)
++#define nfserr_stale_clientid __constant_htonl(NFSERR_STALE_CLIENTID)
++#define nfserr_resource __constant_htonl(NFSERR_RESOURCE)
++#define nfserr_moved __constant_htonl(NFSERR_MOVED)
++#define nfserr_nofilehandle __constant_htonl(NFSERR_NOFILEHANDLE)
++#define nfserr_minor_vers_mismatch __constant_htonl(NFSERR_MINOR_VERS_MISMATCH)
++#define nfserr_share_denied __constant_htonl(NFSERR_SHARE_DENIED)
++#define nfserr_stale_stateid __constant_htonl(NFSERR_STALE_STATEID)
++#define nfserr_old_stateid __constant_htonl(NFSERR_OLD_STATEID)
++#define nfserr_bad_stateid __constant_htonl(NFSERR_BAD_STATEID)
++#define nfserr_bad_seqid __constant_htonl(NFSERR_BAD_SEQID)
++#define nfserr_symlink __constant_htonl(NFSERR_SYMLINK)
++#define nfserr_not_same __constant_htonl(NFSERR_NOT_SAME)
++#define nfserr_restorefh __constant_htonl(NFSERR_RESTOREFH)
++#define nfserr_attrnotsupp __constant_htonl(NFSERR_ATTRNOTSUPP)
++#define nfserr_bad_xdr __constant_htonl(NFSERR_BAD_XDR)
++#define nfserr_openmode __constant_htonl(NFSERR_OPENMODE)
++#define nfserr_locks_held __constant_htonl(NFSERR_LOCKS_HELD)
++#define nfserr_op_illegal __constant_htonl(NFSERR_OP_ILLEGAL)
++#define nfserr_grace __constant_htonl(NFSERR_GRACE)
++#define nfserr_no_grace __constant_htonl(NFSERR_NO_GRACE)
++#define nfserr_reclaim_bad __constant_htonl(NFSERR_RECLAIM_BAD)
++#define nfserr_badname __constant_htonl(NFSERR_BADNAME)
++#define nfserr_cb_path_down __constant_htonl(NFSERR_CB_PATH_DOWN)
++#define nfserr_locked __constant_htonl(NFSERR_LOCKED)
++#define nfserr_wrongsec __constant_htonl(NFSERR_WRONGSEC)
++#define nfserr_badiomode __constant_htonl(NFS4ERR_BADIOMODE)
++#define nfserr_badlayout __constant_htonl(NFS4ERR_BADLAYOUT)
++#define nfserr_bad_session_digest __constant_htonl(NFS4ERR_BAD_SESSION_DIGEST)
++#define nfserr_badsession __constant_htonl(NFS4ERR_BADSESSION)
++#define nfserr_badslot __constant_htonl(NFS4ERR_BADSLOT)
++#define nfserr_complete_already __constant_htonl(NFS4ERR_COMPLETE_ALREADY)
++#define nfserr_conn_not_bound_to_session __constant_htonl(NFS4ERR_CONN_NOT_BOUND_TO_SESSION)
++#define nfserr_deleg_already_wanted __constant_htonl(NFS4ERR_DELEG_ALREADY_WANTED)
++#define nfserr_back_chan_busy __constant_htonl(NFS4ERR_BACK_CHAN_BUSY)
++#define nfserr_layouttrylater __constant_htonl(NFS4ERR_LAYOUTTRYLATER)
++#define nfserr_layoutunavailable __constant_htonl(NFS4ERR_LAYOUTUNAVAILABLE)
++#define nfserr_nomatching_layout __constant_htonl(NFS4ERR_NOMATCHING_LAYOUT)
++#define nfserr_recallconflict __constant_htonl(NFS4ERR_RECALLCONFLICT)
++#define nfserr_unknown_layouttype __constant_htonl(NFS4ERR_UNKNOWN_LAYOUTTYPE)
++#define nfserr_seq_misordered __constant_htonl(NFS4ERR_SEQ_MISORDERED)
++#define nfserr_sequence_pos __constant_htonl(NFS4ERR_SEQUENCE_POS)
++#define nfserr_req_too_big __constant_htonl(NFS4ERR_REQ_TOO_BIG)
++#define nfserr_rep_too_big __constant_htonl(NFS4ERR_REP_TOO_BIG)
++#define nfserr_rep_too_big_to_cache __constant_htonl(NFS4ERR_REP_TOO_BIG_TO_CACHE)
++#define nfserr_retry_uncached_rep __constant_htonl(NFS4ERR_RETRY_UNCACHED_REP)
++#define nfserr_unsafe_compound __constant_htonl(NFS4ERR_UNSAFE_COMPOUND)
++#define nfserr_too_many_ops __constant_htonl(NFS4ERR_TOO_MANY_OPS)
++#define nfserr_op_not_in_session __constant_htonl(NFS4ERR_OP_NOT_IN_SESSION)
++#define nfserr_hash_alg_unsupp __constant_htonl(NFS4ERR_HASH_ALG_UNSUPP)
++#define nfserr_clientid_busy __constant_htonl(NFS4ERR_CLIENTID_BUSY)
++#define nfserr_pnfs_io_hole __constant_htonl(NFS4ERR_PNFS_IO_HOLE)
++#define nfserr_seq_false_retry __constant_htonl(NFS4ERR_SEQ_FALSE_RETRY)
++#define nfserr_bad_high_slot __constant_htonl(NFS4ERR_BAD_HIGH_SLOT)
++#define nfserr_deadsession __constant_htonl(NFS4ERR_DEADSESSION)
++#define nfserr_encr_alg_unsupp __constant_htonl(NFS4ERR_ENCR_ALG_UNSUPP)
++#define nfserr_pnfs_no_layout __constant_htonl(NFS4ERR_PNFS_NO_LAYOUT)
++#define nfserr_not_only_op __constant_htonl(NFS4ERR_NOT_ONLY_OP)
++#define nfserr_wrong_cred __constant_htonl(NFS4ERR_WRONG_CRED)
++#define nfserr_wrong_type __constant_htonl(NFS4ERR_WRONG_TYPE)
++#define nfserr_dirdeleg_unavail __constant_htonl(NFS4ERR_DIRDELEG_UNAVAIL)
++#define nfserr_reject_deleg __constant_htonl(NFS4ERR_REJECT_DELEG)
++#define nfserr_returnconflict __constant_htonl(NFS4ERR_RETURNCONFLICT)
++#define nfserr_deleg_revoked __constant_htonl(NFS4ERR_DELEG_REVOKED)
+
+ /* error codes for internal use */
+ /* if a request fails due to kmalloc failure, it gets dropped.
+ * Client should resend eventually
+ */
+-#define nfserr_dropit cpu_to_be32(30000)
++#define nfserr_dropit __constant_htonl(30000)
+ /* end-of-file indicator in readdir */
+-#define nfserr_eof cpu_to_be32(30001)
++#define nfserr_eof __constant_htonl(30001)
+ /* replay detected */
+-#define nfserr_replay_me cpu_to_be32(11001)
++#define nfserr_replay_me __constant_htonl(11001)
+ /* nfs41 replay detected */
+-#define nfserr_replay_cache cpu_to_be32(11002)
++#define nfserr_replay_cache __constant_htonl(11002)
+
+ /* Check for dir entries '.' and '..' */
+ #define isdotent(n, l) (l < 3 && n[0] == '.' && (l == 1 || n[1] == '.'))
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
-index dc69068..3a0f48f 100644
+index 2a30775..972e62c 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
-@@ -255,7 +255,7 @@ struct svc_rqst {
+@@ -272,7 +272,7 @@ struct svc_rqst {
* determine what device number
* to report (real or virtual)
*/
- int rq_splice_ok; /* turned off in gss privacy
-+ int rq_sendfile_ok; /* turned off in gss privacy
++ int rq_sendfile_ok; /* turned off in gss privacy
* to prevent encrypting page
* cache pages */
wait_queue_head_t rq_wait; /* synchronization */
+diff --git a/include/linux/sunrpc/svc_xprt.h b/include/linux/sunrpc/svc_xprt.h
+index 0d9cb6e..66ac213 100644
+--- a/include/linux/sunrpc/svc_xprt.h
++++ b/include/linux/sunrpc/svc_xprt.h
+@@ -147,13 +147,13 @@ static inline char *__svc_print_addr(const struct sockaddr *addr,
+
+ switch (addr->sa_family) {
+ case AF_INET:
+- snprintf(buf, len, "%pI4, port=%u", &sin->sin_addr,
++ snprintf(buf, len, NIPQUAD_FMT", port=%u", NIPQUAD(sin->sin_addr),
+ ntohs(sin->sin_port));
+ break;
+
+ case AF_INET6:
+- snprintf(buf, len, "%pI6, port=%u",
+- &sin6->sin6_addr,
++ snprintf(buf, len, NIP6_FMT", port=%u",
++ NIP6(sin6->sin6_addr),
+ ntohs(sin6->sin6_port));
+ break;
+
diff --git a/net/sunrpc/auth.c b/net/sunrpc/auth.c
-index 6bfea9e..f0a110d 100644
+index 0c431c2..1b48190 100644
--- a/net/sunrpc/auth.c
+++ b/net/sunrpc/auth.c
-@@ -566,19 +566,16 @@ rpcauth_uptodatecred(struct rpc_task *task)
+@@ -350,18 +350,17 @@ EXPORT_SYMBOL_GPL(rpcauth_lookup_credcache);
+ struct rpc_cred *
+ rpcauth_lookupcred(struct rpc_auth *auth, int flags)
+ {
+- struct auth_cred acred;
++ struct auth_cred acred = {
++ .uid = current->fsuid,
++ .gid = current->fsgid,
++ .group_info = current->group_info,
++ };
+ struct rpc_cred *ret;
+- const struct cred *cred = current_cred();
+
+ dprintk("RPC: looking up %s cred\n",
+ auth->au_ops->au_name);
+
+- memset(&acred, 0, sizeof(acred));
+- acred.uid = cred->fsuid;
+- acred.gid = cred->fsgid;
+- acred.group_info = get_group_info(((struct cred *)cred)->group_info);
+-
++ get_group_info(acred.group_info);
+ ret = auth->au_ops->lookup_cred(auth, &acred, flags);
+ put_group_info(acred.group_info);
+ return ret;
+@@ -568,19 +567,16 @@ rpcauth_uptodatecred(struct rpc_task *task)
test_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags) != 0;
}
@@ -2299,10 +2554,10 @@ index 6bfea9e..f0a110d 100644
+ remove_shrinker(rpc_cred_shrinker);
}
diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
-index 853a414..71ba862 100644
+index e630b38..d207ac1 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
-@@ -481,7 +481,7 @@ gss_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)
+@@ -602,7 +602,7 @@ gss_pipe_downcall(struct file *filp, const char __user *src, size_t mlen)
const void *p, *end;
void *buf;
struct gss_upcall_msg *gss_msg;
@@ -2312,10 +2567,10 @@ index 853a414..71ba862 100644
uid_t uid;
ssize_t err = -EFBIG;
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c
-index 81ae3d6..acfb1d1 100644
+index 2278a50..44b2e70 100644
--- a/net/sunrpc/auth_gss/svcauth_gss.c
+++ b/net/sunrpc/auth_gss/svcauth_gss.c
-@@ -859,7 +859,7 @@ unwrap_priv_data(struct svc_rqst *rqstp, struct xdr_buf *buf, u32 seq, struct gs
+@@ -873,7 +873,7 @@ unwrap_priv_data(struct svc_rqst *rqstp, struct xdr_buf *buf, u32 seq, struct gs
u32 priv_len, maj_stat;
int pad, saved_len, remaining_len, offset;
@@ -2325,10 +2580,10 @@ index 81ae3d6..acfb1d1 100644
priv_len = svc_getnl(&buf->head[0]);
if (rqstp->rq_deferred) {
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
-index c996671..58e606e 100644
+index 20029a7..b682372 100644
--- a/net/sunrpc/cache.c
+++ b/net/sunrpc/cache.c
-@@ -696,7 +696,7 @@ cache_read(struct file *filp, char __user *buf, size_t count, loff_t *ppos)
+@@ -692,7 +692,7 @@ cache_read(struct file *filp, char __user *buf, size_t count, loff_t *ppos)
{
struct cache_reader *rp = filp->private_data;
struct cache_request *rq;
@@ -2337,7 +2592,7 @@ index c996671..58e606e 100644
int err;
if (count == 0)
-@@ -773,7 +773,7 @@ cache_write(struct file *filp, const char __user *buf, size_t count,
+@@ -769,7 +769,7 @@ cache_write(struct file *filp, const char __user *buf, size_t count,
loff_t *ppos)
{
int err;
@@ -2346,7 +2601,7 @@ index c996671..58e606e 100644
if (count == 0)
return 0;
-@@ -804,7 +804,7 @@ cache_poll(struct file *filp, poll_table *wait)
+@@ -800,7 +800,7 @@ cache_poll(struct file *filp, poll_table *wait)
unsigned int mask;
struct cache_reader *rp = filp->private_data;
struct cache_queue *cq;
@@ -2355,7 +2610,7 @@ index c996671..58e606e 100644
poll_wait(filp, &queue_wait, wait);
-@@ -1239,7 +1239,7 @@ static int c_show(struct seq_file *m, void *p)
+@@ -1235,7 +1235,7 @@ static int c_show(struct seq_file *m, void *p)
return cd->cache_show(m, cd, cp);
}
@@ -2364,7 +2619,7 @@ index c996671..58e606e 100644
.start = c_start,
.next = c_next,
.stop = c_stop,
-@@ -1269,7 +1269,7 @@ static const struct file_operations content_file_operations = {
+@@ -1265,7 +1265,7 @@ static const struct file_operations content_file_operations = {
static ssize_t read_flush(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
@@ -2373,7 +2628,7 @@ index c996671..58e606e 100644
char tbuf[20];
unsigned long p = *ppos;
size_t len;
-@@ -1290,7 +1290,7 @@ static ssize_t read_flush(struct file *file, char __user *buf,
+@@ -1286,7 +1286,7 @@ static ssize_t read_flush(struct file *file, char __user *buf,
static ssize_t write_flush(struct file * file, const char __user * buf,
size_t count, loff_t *ppos)
{
@@ -2383,35 +2638,43 @@ index c996671..58e606e 100644
char *ep;
long flushtime;
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
-index 76739e9..11bfb52 100644
+index 5abab09..6555f87 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
-@@ -213,10 +213,10 @@ static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args, stru
- }
-
- /* save the nodename */
-- clnt->cl_nodelen = strlen(utsname()->nodename);
-+ clnt->cl_nodelen = strlen(system_utsname.nodename);
- if (clnt->cl_nodelen > UNX_MAXNODENAME)
- clnt->cl_nodelen = UNX_MAXNODENAME;
-- memcpy(clnt->cl_nodename, utsname()->nodename, clnt->cl_nodelen);
-+ memcpy(clnt->cl_nodename, system_utsname.nodename, clnt->cl_nodelen);
- rpc_register_client(clnt);
- return clnt;
-
+@@ -279,15 +279,15 @@ struct rpc_clnt *rpc_create(struct rpc_create_args *args)
+ case AF_INET: {
+ struct sockaddr_in *sin =
+ (struct sockaddr_in *)args->address;
+- snprintf(servername, sizeof(servername), "%pI4",
+- &sin->sin_addr.s_addr);
++ snprintf(servername, sizeof(servername), NIPQUAD_FMT,
++ NIPQUAD(sin->sin_addr.s_addr));
+ break;
+ }
+ case AF_INET6: {
+ struct sockaddr_in6 *sin =
+ (struct sockaddr_in6 *)args->address;
+- snprintf(servername, sizeof(servername), "%pI6",
+- &sin->sin6_addr);
++ snprintf(servername, sizeof(servername), NIP6_FMT,
++ NIP6(sin->sin6_addr));
+ break;
+ }
+ default:
diff --git a/net/sunrpc/rpc_pipe.c b/net/sunrpc/rpc_pipe.c
-index 23a2b8f..003a6ec 100644
+index 9ced062..aad5e3e 100644
--- a/net/sunrpc/rpc_pipe.c
+++ b/net/sunrpc/rpc_pipe.c
-@@ -26,6 +26,7 @@
- #include <linux/sunrpc/clnt.h>
- #include <linux/workqueue.h>
- #include <linux/sunrpc/rpc_pipe_fs.h>
-+#include <linux/path.h>
+@@ -14,7 +14,7 @@
+ #include <linux/pagemap.h>
+ #include <linux/mount.h>
+ #include <linux/namei.h>
+-#include <linux/fsnotify.h>
++#include <linux/dnotify.h>
+ #include <linux/kernel.h>
- static struct vfsmount *rpc_mount __read_mostly;
- static int rpc_mount_count;
-@@ -224,7 +225,7 @@ out:
+ #include <asm/ioctls.h>
+@@ -235,7 +235,7 @@ out:
static ssize_t
rpc_pipe_read(struct file *filp, char __user *buf, size_t len, loff_t *offset)
{
@@ -2420,7 +2683,7 @@ index 23a2b8f..003a6ec 100644
struct rpc_inode *rpci = RPC_I(inode);
struct rpc_pipe_msg *msg;
int res = 0;
-@@ -267,7 +268,7 @@ out_unlock:
+@@ -278,7 +278,7 @@ out_unlock:
static ssize_t
rpc_pipe_write(struct file *filp, const char __user *buf, size_t len, loff_t *offset)
{
@@ -2429,7 +2692,7 @@ index 23a2b8f..003a6ec 100644
struct rpc_inode *rpci = RPC_I(inode);
int res;
-@@ -285,7 +286,7 @@ rpc_pipe_poll(struct file *filp, struct poll_table_struct *wait)
+@@ -296,7 +296,7 @@ rpc_pipe_poll(struct file *filp, struct poll_table_struct *wait)
struct rpc_inode *rpci;
unsigned int mask = 0;
@@ -2438,7 +2701,7 @@ index 23a2b8f..003a6ec 100644
poll_wait(filp, &rpci->waitq, wait);
mask = POLLOUT | POLLWRNORM;
-@@ -300,7 +301,7 @@ static int
+@@ -311,7 +311,7 @@ static int
rpc_pipe_ioctl(struct inode *ino, struct file *filp,
unsigned int cmd, unsigned long arg)
{
@@ -2447,7 +2710,16 @@ index 23a2b8f..003a6ec 100644
int len;
switch (cmd) {
-@@ -495,7 +496,7 @@ rpc_lookup_parent(char *path, struct nameidata *nd)
+@@ -480,7 +480,7 @@ static int rpc_delete_dentry(struct dentry *dentry)
+ return 1;
+ }
+
+-static const struct dentry_operations rpc_dentry_operations = {
++static struct dentry_operations rpc_dentry_operations = {
+ .d_delete = rpc_delete_dentry,
+ };
+
+@@ -511,7 +511,7 @@ rpc_lookup_parent(char *path, struct nameidata *nd)
static void
rpc_release_path(struct nameidata *nd)
{
@@ -2456,7 +2728,24 @@ index 23a2b8f..003a6ec 100644
rpc_put_mount();
}
-@@ -668,7 +669,7 @@ rpc_lookup_negative(char *path, struct nameidata *nd)
+@@ -611,7 +611,6 @@ rpc_populate(struct dentry *parent,
+ if (S_ISDIR(mode))
+ inc_nlink(dir);
+ d_add(dentry, inode);
+- fsnotify_create(dir, dentry);
+ }
+ mutex_unlock(&dir->i_mutex);
+ return 0;
+@@ -633,7 +632,7 @@ __rpc_mkdir(struct inode *dir, struct dentry *dentry)
+ inode->i_ino = iunique(dir->i_sb, 100);
+ d_instantiate(dentry, inode);
+ inc_nlink(dir);
+- fsnotify_mkdir(dir, dentry);
++ inode_dir_notify(dir, DN_CREATE);
+ return 0;
+ out_err:
+ printk(KERN_WARNING "%s: %s failed to allocate inode for dentry %s\n",
+@@ -682,7 +681,7 @@ rpc_lookup_negative(char *path, struct nameidata *nd)
if ((error = rpc_lookup_parent(path, nd)) != 0)
return ERR_PTR(error);
@@ -2465,7 +2754,7 @@ index 23a2b8f..003a6ec 100644
1);
if (IS_ERR(dentry))
rpc_release_path(nd);
-@@ -696,7 +697,7 @@ rpc_mkdir(char *path, struct rpc_clnt *rpc_client)
+@@ -710,7 +709,7 @@ rpc_mkdir(char *path, struct rpc_clnt *rpc_client)
dentry = rpc_lookup_negative(path, &nd);
if (IS_ERR(dentry))
return dentry;
@@ -2474,7 +2763,16 @@ index 23a2b8f..003a6ec 100644
if ((error = __rpc_mkdir(dir, dentry)) != 0)
goto err_dput;
RPC_I(dentry->d_inode)->private = rpc_client;
-@@ -897,7 +898,7 @@ static struct file_system_type rpc_pipe_fs_type = {
+@@ -809,7 +808,7 @@ rpc_mkpipe(struct dentry *parent, const char *name, void *private, struct rpc_pi
+ rpci->flags = flags;
+ rpci->ops = ops;
+ rpci->nkern_readwriters = 1;
+- fsnotify_create(dir, dentry);
++ inode_dir_notify(dir, DN_CREATE);
+ dget(dentry);
+ out:
+ mutex_unlock(&dir->i_mutex);
+@@ -911,7 +910,7 @@ static struct file_system_type rpc_pipe_fs_type = {
};
static void
@@ -2484,81 +2782,67 @@ index 23a2b8f..003a6ec 100644
struct rpc_inode *rpci = (struct rpc_inode *) foo;
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c
-index 24db2b4..6f9e46c 100644
+index beee6da..e87eab5 100644
--- a/net/sunrpc/rpcb_clnt.c
+++ b/net/sunrpc/rpcb_clnt.c
-@@ -117,18 +117,6 @@ static void rpcb_map_release(void *data)
- kfree(map);
- }
+@@ -127,8 +127,8 @@ static void rpcb_map_release(void *data)
--static const struct sockaddr_in rpcb_inaddr_loopback = {
-- .sin_family = AF_INET,
+ static const struct sockaddr_in rpcb_inaddr_loopback = {
+ .sin_family = AF_INET,
- .sin_addr.s_addr = htonl(INADDR_LOOPBACK),
- .sin_port = htons(RPCBIND_PORT),
--};
--
--static const struct sockaddr_in6 rpcb_in6addr_loopback = {
-- .sin6_family = AF_INET6,
-- .sin6_addr = IN6ADDR_LOOPBACK_INIT,
-- .sin6_port = htons(RPCBIND_PORT),
--};
--
- static struct rpc_clnt *rpcb_create_local(struct sockaddr *addr,
- size_t addrlen, u32 version)
- {
-@@ -249,6 +237,12 @@ int rpcb_register(u32 prog, u32 vers, int prot, unsigned short port, int *okay)
- .rpc_resp = okay,
- };
++ .sin_addr.s_addr = __constant_htonl(INADDR_LOOPBACK),
++ .sin_port = __constant_htons(RPCBIND_PORT),
+ };
-+ struct sockaddr_in rpcb_inaddr_loopback = {
-+ .sin_family = AF_INET,
-+ .sin_addr.s_addr = htonl(INADDR_LOOPBACK),
-+ .sin_port = htons(RPCBIND_PORT),
-+ };
-+
- dprintk("RPC: %sregistering (%u, %u, %d, %u) with local "
- "rpcbind\n", (port ? "" : "un"),
- prog, vers, prot, port);
-@@ -272,6 +266,12 @@ static int rpcb_register_netid4(struct sockaddr_in *address_to_register,
- unsigned short port = ntohs(address_to_register->sin_port);
+ static struct rpc_clnt *rpcb_create_local(struct sockaddr *addr,
+@@ -271,8 +271,8 @@ static int rpcb_register_inet4(const struct sockaddr *sap,
char buf[32];
-+ struct sockaddr_in rpcb_inaddr_loopback = {
-+ .sin_family = AF_INET,
-+ .sin_addr.s_addr = htonl(INADDR_LOOPBACK),
-+ .sin_port = htons(RPCBIND_PORT),
-+ };
-+
/* Construct AF_INET universal address */
- snprintf(buf, sizeof(buf),
- NIPQUAD_FMT".%u.%u",
-@@ -303,6 +303,12 @@ static int rpcb_register_netid6(struct sockaddr_in6 *address_to_register,
- unsigned short port = ntohs(address_to_register->sin6_port);
- char buf[64];
-
-+ struct sockaddr_in6 rpcb_in6addr_loopback = {
-+ .sin6_family = AF_INET6,
-+ .sin6_addr = IN6ADDR_LOOPBACK_INIT,
-+ .sin6_port = htons(RPCBIND_PORT),
-+ };
-+
- /* Construct AF_INET6 universal address */
- snprintf(buf, sizeof(buf),
- NIP6_FMT".%u.%u",
+- snprintf(buf, sizeof(buf), "%pI4.%u.%u",
+- &sin->sin_addr.s_addr, port >> 8, port & 0xff);
++ snprintf(buf, sizeof(buf), NIPQUAD_FMT".%u.%u",
++ NIPQUAD(sin->sin_addr.s_addr), port >> 8, port & 0xff);
+ map->r_addr = buf;
+
+ dprintk("RPC: %sregistering [%u, %u, %s, '%s'] with "
+@@ -303,8 +303,8 @@ static int rpcb_register_inet6(const struct sockaddr *sap,
+ snprintf(buf, sizeof(buf), "::.%u.%u",
+ port >> 8, port & 0xff);
+ else
+- snprintf(buf, sizeof(buf), "%pI6.%u.%u",
+- &sin6->sin6_addr, port >> 8, port & 0xff);
++ snprintf(buf, sizeof(buf), NIP6_FMT".%u.%u",
++ NIP6(sin6->sin6_addr), port >> 8, port & 0xff);
+ map->r_addr = buf;
+
+ dprintk("RPC: %sregistering [%u, %u, %s, '%s'] with "
+@@ -433,8 +433,8 @@ int rpcb_getport_sync(struct sockaddr_in *sin, u32 prog, u32 vers, int prot)
+ struct rpc_clnt *rpcb_clnt;
+ int status;
+
+- dprintk("RPC: %s(%pI4, %u, %u, %d)\n",
+- __func__, &sin->sin_addr.s_addr, prog, vers, prot);
++ dprintk("RPC: %s("NIPQUAD_FMT", %u, %u, %d)\n",
++ __func__, NIPQUAD(sin->sin_addr.s_addr), prog, vers, prot);
+
+ rpcb_clnt = rpcb_create(NULL, (struct sockaddr *)sin,
+ sizeof(*sin), prot, RPCBVERS_2);
diff --git a/net/sunrpc/stats.c b/net/sunrpc/stats.c
-index 50b049c..5053a5f 100644
+index 1ef6e46..3713319 100644
--- a/net/sunrpc/stats.c
+++ b/net/sunrpc/stats.c
-@@ -264,7 +264,7 @@ rpc_proc_init(void)
+@@ -263,7 +263,7 @@ rpc_proc_init(void)
+ {
dprintk("RPC: registering /proc/net/rpc\n");
- if (!proc_net_rpc) {
- struct proc_dir_entry *ent;
-- ent = proc_mkdir("rpc", init_net.proc_net);
-+ ent = proc_mkdir("rpc", proc_net);
- if (ent) {
- ent->owner = THIS_MODULE;
- proc_net_rpc = ent;
-@@ -278,7 +278,7 @@ rpc_proc_exit(void)
+ if (!proc_net_rpc)
+- proc_net_rpc = proc_mkdir("rpc", init_net.proc_net);
++ proc_net_rpc = proc_mkdir("rpc", proc_net);
+ }
+
+ void
+@@ -272,7 +272,7 @@ rpc_proc_exit(void)
dprintk("RPC: unregistering /proc/net/rpc\n");
if (proc_net_rpc) {
proc_net_rpc = NULL;
@@ -2568,70 +2852,87 @@ index 50b049c..5053a5f 100644
}
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
-index 5a32cb7..e0e87c6 100644
+index 8847add..8bfdc87 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
-@@ -174,7 +174,7 @@ fail:
- static int
- svc_pool_map_init_percpu(struct svc_pool_map *m)
- {
-- unsigned int maxpools = nr_cpu_ids;
-+ unsigned int maxpools = highest_possible_processor_id() + 1;
- unsigned int pidx = 0;
- unsigned int cpu;
- int err;
-@@ -202,7 +202,7 @@ svc_pool_map_init_percpu(struct svc_pool_map *m)
- static int
- svc_pool_map_init_pernode(struct svc_pool_map *m)
- {
-- unsigned int maxpools = nr_node_ids;
-+ unsigned int maxpools = highest_possible_processor_id() + 1;
- unsigned int pidx = 0;
- unsigned int node;
- int err;
-@@ -310,13 +310,12 @@ svc_pool_map_set_cpumask(struct task_struct *task, unsigned int pidx)
- switch (m->mode) {
- case SVC_POOL_PERCPU:
- {
-- set_cpus_allowed_ptr(task, &cpumask_of_cpu(node));
-+ set_cpus_allowed(task, cpumask_of_cpu(node));
- break;
- }
- case SVC_POOL_PERNODE:
- {
-- node_to_cpumask_ptr(nodecpumask, node);
-- set_cpus_allowed_ptr(task, nodecpumask);
-+ set_cpus_allowed(task, node_to_cpumask(node));
- break;
- }
- }
-@@ -831,7 +830,7 @@ svc_process(struct svc_rqst *rqstp)
+@@ -1007,7 +1007,7 @@ svc_process(struct svc_rqst *rqstp)
rqstp->rq_res.tail[0].iov_base = NULL;
rqstp->rq_res.tail[0].iov_len = 0;
/* Will be turned off only in gss privacy case: */
- rqstp->rq_splice_ok = 1;
+ rqstp->rq_sendfile_ok = 1;
+ /* Will be turned off only when NFSv4 Sessions are used */
+ rqstp->rq_usedeferral = 1;
+
+diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
+index c200d92..554296d 100644
+--- a/net/sunrpc/svc_xprt.c
++++ b/net/sunrpc/svc_xprt.c
+@@ -1202,7 +1202,7 @@ static int svc_pool_stats_show(struct seq_file *m, void *p)
+ return 0;
+ }
- /* Setup reply header */
- rqstp->rq_xprt->xpt_ops->xpo_prep_reply_hdr(rqstp);
+-static const struct seq_operations svc_pool_stats_seq_ops = {
++static struct seq_operations svc_pool_stats_seq_ops = {
+ .start = svc_pool_stats_start,
+ .next = svc_pool_stats_next,
+ .stop = svc_pool_stats_stop,
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c
-index f24800f..b30d725 100644
+index 5c865e2..78d7d0d 100644
--- a/net/sunrpc/svcauth_unix.c
+++ b/net/sunrpc/svcauth_unix.c
-@@ -678,7 +678,7 @@ int
- svcauth_unix_set_client(struct svc_rqst *rqstp)
- {
- struct sockaddr_in *sin;
-- struct sockaddr_in6 *sin6, sin6_storage;
-+ struct sockaddr_in6 *sin6 = NULL, sin6_storage;
- struct ip_map *ipm;
+@@ -162,9 +162,9 @@ static void ip_map_request(struct cache_detail *cd,
+ struct ip_map *im = container_of(h, struct ip_map, h);
+
+ if (ipv6_addr_v4mapped(&(im->m_addr))) {
+- snprintf(text_addr, 20, "%pI4", &im->m_addr.s6_addr32[3]);
++ snprintf(text_addr, 20, NIPQUAD_FMT, NIPQUAD(im->m_addr.s6_addr32[3]));
+ } else {
+- snprintf(text_addr, 40, "%pI6", &im->m_addr);
++ snprintf(text_addr, 40, NIP6_FMT, NIP6(im->m_addr));
+ }
+ qword_add(bpp, blen, im->m_class);
+ qword_add(bpp, blen, text_addr);
+@@ -274,10 +274,10 @@ static int ip_map_show(struct seq_file *m,
+ dom = im->m_client->h.name;
+
+ if (ipv6_addr_v4mapped(&addr)) {
+- seq_printf(m, "%s %pI4 %s\n",
+- im->m_class, &addr.s6_addr32[3], dom);
++ seq_printf(m, "%s "NIPQUAD_FMT" %s\n",
++ im->m_class, NIPQUAD(addr.s6_addr32[3]), dom);
+ } else {
+- seq_printf(m, "%s %pI6 %s\n", im->m_class, &addr, dom);
++ seq_printf(m, "%s "NIP6_FMT" %s\n", im->m_class, NIP6(addr), dom);
+ }
+ return 0;
+ }
+@@ -683,6 +683,7 @@ svcauth_unix_set_client(struct svc_rqst *rqstp)
+ break;
+ default:
+ BUG();
++ return -1;
+ }
- switch (rqstp->rq_addr.ss_family) {
+ rqstp->rq_client = NULL;
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
-index 3e65719..cbb47a6 100644
+index af31988..3d7d7a6 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
-@@ -472,12 +472,16 @@ static int svc_udp_recvfrom(struct svc_rqst *rqstp)
+@@ -246,10 +246,10 @@ static int one_sock_name(char *buf, struct svc_sock *svsk)
+
+ switch(svsk->sk_sk->sk_family) {
+ case AF_INET:
+- len = sprintf(buf, "ipv4 %s %pI4 %d\n",
++ len = sprintf(buf, "ipv4 %s "NIPQUAD_FMT" %d\n",
+ svsk->sk_sk->sk_protocol == IPPROTO_UDP ?
+ "udp" : "tcp",
+- &inet_sk(svsk->sk_sk)->rcv_saddr,
++ NIPQUAD(inet_sk(svsk->sk_sk)->rcv_saddr),
+ inet_sk(svsk->sk_sk)->num);
+ break;
+ default:
+@@ -467,12 +467,16 @@ static int svc_udp_recvfrom(struct svc_rqst *rqstp)
if (len < 0)
return len;
rqstp->rq_addrlen = len;
@@ -2639,7 +2940,7 @@ index 3e65719..cbb47a6 100644
- skb->tstamp = ktime_get_real();
+ if (skb->tstamp.off_sec == 0) {
+ struct timeval tv;
-+
++
+ tv.tv_sec = xtime.tv_sec;
+ tv.tv_usec = xtime.tv_nsec / NSEC_PER_USEC;
+ skb_set_timestamp(skb, &tv);
@@ -2652,14 +2953,14 @@ index 3e65719..cbb47a6 100644
/*
diff --git a/net/sunrpc/sysctl.c b/net/sunrpc/sysctl.c
-index 5231f7a..1482e34 100644
+index 5231f7a..ac09d2d 100644
--- a/net/sunrpc/sysctl.c
+++ b/net/sunrpc/sysctl.c
@@ -135,6 +135,7 @@ done:
static ctl_table debug_table[] = {
{
-+ .ctl_name = CTL_RPCDEBUG,
++ .ctl_name = CTL_UNNUMBERED,
.procname = "rpc_debug",
.data = &rpc_debug,
.maxlen = sizeof(int),
@@ -2667,7 +2968,7 @@ index 5231f7a..1482e34 100644
.proc_handler = &proc_dodebug
},
{
-+ .ctl_name = CTL_NFSDEBUG,
++ .ctl_name = CTL_UNNUMBERED,
.procname = "nfs_debug",
.data = &nfs_debug,
.maxlen = sizeof(int),
@@ -2675,7 +2976,7 @@ index 5231f7a..1482e34 100644
.proc_handler = &proc_dodebug
},
{
-+ .ctl_name = CTL_NFSDDEBUG,
++ .ctl_name = CTL_UNNUMBERED,
.procname = "nfsd_debug",
.data = &nfsd_debug,
.maxlen = sizeof(int),
@@ -2683,7 +2984,7 @@ index 5231f7a..1482e34 100644
.proc_handler = &proc_dodebug
},
{
-+ .ctl_name = CTL_NLMDEBUG,
++ .ctl_name = CTL_UNNUMBERED,
.procname = "nlm_debug",
.data = &nlm_debug,
.maxlen = sizeof(int),
@@ -2691,46 +2992,32 @@ index 5231f7a..1482e34 100644
.proc_handler = &proc_dodebug
},
{
-+ .ctl_name = CTL_TRANSPORT,
++ .ctl_name = CTL_UNNUMBERED,
.procname = "transports",
.maxlen = 256,
.mode = 0444,
-diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c
-index 6fb493c..761ad29 100644
---- a/net/sunrpc/xprtrdma/svc_rdma_transport.c
-+++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c
-@@ -247,10 +247,6 @@ static void rq_comp_handler(struct ib_cq *cq, void *cq_context)
- struct svcxprt_rdma *xprt = cq_context;
- unsigned long flags;
-
-- /* Guard against unconditional flush call for destroyed QP */
-- if (atomic_read(&xprt->sc_xprt.xpt_ref.refcount)==0)
-- return;
--
- /*
- * Set the bit regardless of whether or not it's on the list
- * because it may be on the list already due to an SQ
-@@ -411,10 +407,6 @@ static void sq_comp_handler(struct ib_cq *cq, void *cq_context)
- struct svcxprt_rdma *xprt = cq_context;
- unsigned long flags;
-
-- /* Guard against unconditional flush call for destroyed QP */
-- if (atomic_read(&xprt->sc_xprt.xpt_ref.refcount)==0)
-- return;
--
- /*
- * Set the bit regardless of whether or not it's on the list
- * because it may be on the list already due to an RQ
-@@ -1116,9 +1108,6 @@ static void __svc_rdma_free(struct work_struct *work)
- container_of(work, struct svcxprt_rdma, sc_work);
- dprintk("svcrdma: svc_rdma_free(%p)\n", rdma);
+diff --git a/net/sunrpc/xprtrdma/rpc_rdma.c b/net/sunrpc/xprtrdma/rpc_rdma.c
+index e5e28d1..913e50e 100644
+--- a/net/sunrpc/xprtrdma/rpc_rdma.c
++++ b/net/sunrpc/xprtrdma/rpc_rdma.c
+@@ -784,7 +784,7 @@ repost:
+ /* check for expected message types */
+ /* The order of some of these tests is important. */
+ switch (headerp->rm_type) {
+- case htonl(RDMA_MSG):
++ case __constant_htonl(RDMA_MSG):
+ /* never expect read chunks */
+ /* never expect reply chunks (two ways to check) */
+ /* never expect write chunks without having offered RDMA */
+@@ -823,7 +823,7 @@ repost:
+ rpcrdma_inline_fixup(rqst, (char *)iptr, rep->rr_len, rdmalen);
+ break;
-- /* We should only be called from kref_put */
-- BUG_ON(atomic_read(&rdma->sc_xprt.xpt_ref.refcount) != 0);
--
- /*
- * Destroy queued, but not processed read completions. Note
- * that this cleanup has to be done before destroying the
+- case htonl(RDMA_NOMSG):
++ case __constant_htonl(RDMA_NOMSG):
+ /* never expect read or write chunks, always reply chunks */
+ if (headerp->rm_body.rm_chunks[0] != xdr_zero ||
+ headerp->rm_body.rm_chunks[1] != xdr_zero ||
diff --git a/net/sunrpc/xprtrdma/svc_rdma.c b/net/sunrpc/xprtrdma/svc_rdma.c
index 8710117..ce94fa4 100644
--- a/net/sunrpc/xprtrdma/svc_rdma.c
@@ -2839,3 +3126,250 @@ index 8710117..ce94fa4 100644
.procname = "svc_rdma",
.mode = 0555,
.child = svcrdma_parm_table
+diff --git a/net/sunrpc/xprtrdma/svc_rdma_transport.c b/net/sunrpc/xprtrdma/svc_rdma_transport.c
+index 3d810e7..9030d8e 100644
+--- a/net/sunrpc/xprtrdma/svc_rdma_transport.c
++++ b/net/sunrpc/xprtrdma/svc_rdma_transport.c
+@@ -247,10 +247,6 @@ static void rq_comp_handler(struct ib_cq *cq, void *cq_context)
+ struct svcxprt_rdma *xprt = cq_context;
+ unsigned long flags;
+
+- /* Guard against unconditional flush call for destroyed QP */
+- if (atomic_read(&xprt->sc_xprt.xpt_ref.refcount)==0)
+- return;
+-
+ /*
+ * Set the bit regardless of whether or not it's on the list
+ * because it may be on the list already due to an SQ
+@@ -411,10 +407,6 @@ static void sq_comp_handler(struct ib_cq *cq, void *cq_context)
+ struct svcxprt_rdma *xprt = cq_context;
+ unsigned long flags;
+
+- /* Guard against unconditional flush call for destroyed QP */
+- if (atomic_read(&xprt->sc_xprt.xpt_ref.refcount)==0)
+- return;
+-
+ /*
+ * Set the bit regardless of whether or not it's on the list
+ * because it may be on the list already due to an RQ
+@@ -1048,21 +1040,21 @@ static struct svc_xprt *svc_rdma_accept(struct svc_xprt *xprt)
+
+ dprintk("svcrdma: new connection %p accepted with the following "
+ "attributes:\n"
+- " local_ip : %pI4\n"
++ " local_ip : "NIPQUAD_FMT"\n"
+ " local_port : %d\n"
+- " remote_ip : %pI4\n"
++ " remote_ip : "NIPQUAD_FMT"\n"
+ " remote_port : %d\n"
+ " max_sge : %d\n"
+ " sq_depth : %d\n"
+ " max_requests : %d\n"
+ " ord : %d\n",
+ newxprt,
+- &((struct sockaddr_in *)&newxprt->sc_cm_id->
+- route.addr.src_addr)->sin_addr.s_addr,
++ NIPQUAD(((struct sockaddr_in *)&newxprt->sc_cm_id->
++ route.addr.src_addr)->sin_addr.s_addr),
+ ntohs(((struct sockaddr_in *)&newxprt->sc_cm_id->
+ route.addr.src_addr)->sin_port),
+- &((struct sockaddr_in *)&newxprt->sc_cm_id->
+- route.addr.dst_addr)->sin_addr.s_addr,
++ NIPQUAD(((struct sockaddr_in *)&newxprt->sc_cm_id->
++ route.addr.dst_addr)->sin_addr.s_addr),
+ ntohs(((struct sockaddr_in *)&newxprt->sc_cm_id->
+ route.addr.dst_addr)->sin_port),
+ newxprt->sc_max_sge,
+@@ -1116,9 +1108,6 @@ static void __svc_rdma_free(struct work_struct *work)
+ container_of(work, struct svcxprt_rdma, sc_work);
+ dprintk("svcrdma: svc_rdma_free(%p)\n", rdma);
+
+- /* We should only be called from kref_put */
+- BUG_ON(atomic_read(&rdma->sc_xprt.xpt_ref.refcount) != 0);
+-
+ /*
+ * Destroy queued, but not processed read completions. Note
+ * that this cleanup has to be done before destroying the
+diff --git a/net/sunrpc/xprtrdma/transport.c b/net/sunrpc/xprtrdma/transport.c
+index 1dd6123..cc21d83 100644
+--- a/net/sunrpc/xprtrdma/transport.c
++++ b/net/sunrpc/xprtrdma/transport.c
+@@ -174,7 +174,7 @@ xprt_rdma_format_addresses(struct rpc_xprt *xprt)
+
+ buf = kzalloc(20, GFP_KERNEL);
+ if (buf)
+- snprintf(buf, 20, "%pI4", &addr->sin_addr.s_addr);
++ snprintf(buf, 20, NIPQUAD_FMT, NIPQUAD(addr->sin_addr.s_addr));
+ xprt->address_strings[RPC_DISPLAY_ADDR] = buf;
+
+ buf = kzalloc(8, GFP_KERNEL);
+@@ -186,8 +186,8 @@ xprt_rdma_format_addresses(struct rpc_xprt *xprt)
+
+ buf = kzalloc(48, GFP_KERNEL);
+ if (buf)
+- snprintf(buf, 48, "addr=%pI4 port=%u proto=%s",
+- &addr->sin_addr.s_addr,
++ snprintf(buf, 48, "addr="NIPQUAD_FMT" port=%u proto=%s",
++ NIPQUAD(addr->sin_addr.s_addr),
+ ntohs(addr->sin_port), "rdma");
+ xprt->address_strings[RPC_DISPLAY_ALL] = buf;
+
+@@ -204,8 +204,8 @@ xprt_rdma_format_addresses(struct rpc_xprt *xprt)
+
+ buf = kzalloc(30, GFP_KERNEL);
+ if (buf)
+- snprintf(buf, 30, "%pI4.%u.%u",
+- &addr->sin_addr.s_addr,
++ snprintf(buf, 30, NIPQUAD_FMT".%u.%u",
++ NIPQUAD(addr->sin_addr.s_addr),
+ ntohs(addr->sin_port) >> 8,
+ ntohs(addr->sin_port) & 0xff);
+ xprt->address_strings[RPC_DISPLAY_UNIVERSAL_ADDR] = buf;
+@@ -369,8 +369,8 @@ xprt_setup_rdma(struct xprt_create *args)
+ if (ntohs(sin->sin_port) != 0)
+ xprt_set_bound(xprt);
+
+- dprintk("RPC: %s: %pI4:%u\n",
+- __func__, &sin->sin_addr.s_addr, ntohs(sin->sin_port));
++ dprintk("RPC: %s: "NIPQUAD_FMT":%u\n",
++ __func__, NIPQUAD(sin->sin_addr.s_addr), ntohs(sin->sin_port));
+
+ /* Set max requests */
+ cdata.max_requests = xprt->max_reqs;
+diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
+index 3b21e0c..5d234d6 100644
+--- a/net/sunrpc/xprtrdma/verbs.c
++++ b/net/sunrpc/xprtrdma/verbs.c
+@@ -325,11 +325,11 @@ rpcrdma_conn_upcall(struct rdma_cm_id *id, struct rdma_cm_event *event)
+ case RDMA_CM_EVENT_DEVICE_REMOVAL:
+ connstate = -ENODEV;
+ connected:
+- dprintk("RPC: %s: %s: %pI4:%u (ep 0x%p event 0x%x)\n",
++ dprintk("RPC: %s: %s: "NIPQUAD_FMT":%u (ep 0x%p event 0x%x)\n",
+ __func__,
+ (event->event <= 11) ? conn[event->event] :
+ "unknown connection error",
+- &addr->sin_addr.s_addr,
++ NIPQUAD(addr->sin_addr.s_addr),
+ ntohs(addr->sin_port),
+ ep, event->event);
+ atomic_set(&rpcx_to_rdmax(ep->rep_xprt)->rx_buf.rb_credits, 1);
+@@ -349,17 +349,17 @@ connected:
+ if (connstate == 1) {
+ int ird = attr.max_dest_rd_atomic;
+ int tird = ep->rep_remote_cma.responder_resources;
+- printk(KERN_INFO "rpcrdma: connection to %pI4:%u "
++ printk(KERN_INFO "rpcrdma: connection to "NIPQUAD_FMT":%u "
+ "on %s, memreg %d slots %d ird %d%s\n",
+- &addr->sin_addr.s_addr,
++ NIPQUAD(addr->sin_addr.s_addr),
+ ntohs(addr->sin_port),
+ ia->ri_id->device->name,
+ ia->ri_memreg_strategy,
+ xprt->rx_buf.rb_max_requests,
+ ird, ird < 4 && ird < tird / 2 ? " (low!)" : "");
+ } else if (connstate < 0) {
+- printk(KERN_INFO "rpcrdma: connection to %pI4:%u closed (%d)\n",
+- &addr->sin_addr.s_addr,
++ printk(KERN_INFO "rpcrdma: connection to "NIPQUAD_FMT":%u closed (%d)\n",
++ NIPQUAD(addr->sin_addr.s_addr),
+ ntohs(addr->sin_port),
+ connstate);
+ }
+diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
+index e185961..2de8b4e 100644
+--- a/net/sunrpc/xprtsock.c
++++ b/net/sunrpc/xprtsock.c
+@@ -295,7 +295,7 @@ static void xs_format_ipv4_peer_addresses(struct rpc_xprt *xprt,
+
+ buf = kzalloc(20, GFP_KERNEL);
+ if (buf) {
+- snprintf(buf, 20, "%pI4", &addr->sin_addr.s_addr);
++ snprintf(buf, 20, NIPQUAD_FMT, NIPQUAD(addr->sin_addr.s_addr));
+ }
+ xprt->address_strings[RPC_DISPLAY_ADDR] = buf;
+
+@@ -310,8 +310,8 @@ static void xs_format_ipv4_peer_addresses(struct rpc_xprt *xprt,
+
+ buf = kzalloc(48, GFP_KERNEL);
+ if (buf) {
+- snprintf(buf, 48, "addr=%pI4 port=%u proto=%s",
+- &addr->sin_addr.s_addr,
++ snprintf(buf, 48, "addr="NIPQUAD_FMT" port=%u proto=%s",
++ NIPQUAD(addr->sin_addr.s_addr),
+ ntohs(addr->sin_port),
+ protocol);
+ }
+@@ -333,8 +333,8 @@ static void xs_format_ipv4_peer_addresses(struct rpc_xprt *xprt,
+
+ buf = kzalloc(30, GFP_KERNEL);
+ if (buf) {
+- snprintf(buf, 30, "%pI4.%u.%u",
+- &addr->sin_addr.s_addr,
++ snprintf(buf, 30, NIPQUAD_FMT".%u.%u",
++ NIPQUAD(addr->sin_addr.s_addr),
+ ntohs(addr->sin_port) >> 8,
+ ntohs(addr->sin_port) & 0xff);
+ }
+@@ -352,7 +352,7 @@ static void xs_format_ipv6_peer_addresses(struct rpc_xprt *xprt,
+
+ buf = kzalloc(40, GFP_KERNEL);
+ if (buf) {
+- snprintf(buf, 40, "%pI6",&addr->sin6_addr);
++ snprintf(buf, 40, NIP6_FMT, NIP6(addr->sin6_addr));
+ }
+ xprt->address_strings[RPC_DISPLAY_ADDR] = buf;
+
+@@ -367,8 +367,8 @@ static void xs_format_ipv6_peer_addresses(struct rpc_xprt *xprt,
+
+ buf = kzalloc(64, GFP_KERNEL);
+ if (buf) {
+- snprintf(buf, 64, "addr=%pI6 port=%u proto=%s",
+- &addr->sin6_addr,
++ snprintf(buf, 64, "addr="NIP6_FMT" port=%u proto=%s",
++ NIP6(addr->sin6_addr),
+ ntohs(addr->sin6_port),
+ protocol);
+ }
+@@ -376,7 +376,7 @@ static void xs_format_ipv6_peer_addresses(struct rpc_xprt *xprt,
+
+ buf = kzalloc(36, GFP_KERNEL);
+ if (buf)
+- snprintf(buf, 36, "%pi6", &addr->sin6_addr);
++ snprintf(buf, 36, NIP6_FMT, NIP6(addr->sin6_addr));
+
+ xprt->address_strings[RPC_DISPLAY_HEX_ADDR] = buf;
+
+@@ -389,8 +389,8 @@ static void xs_format_ipv6_peer_addresses(struct rpc_xprt *xprt,
+
+ buf = kzalloc(50, GFP_KERNEL);
+ if (buf) {
+- snprintf(buf, 50, "%pI6.%u.%u",
+- &addr->sin6_addr,
++ snprintf(buf, 50, NIP6_FMT".%u.%u",
++ NIP6(addr->sin6_addr),
+ ntohs(addr->sin6_port) >> 8,
+ ntohs(addr->sin6_port) & 0xff);
+ }
+@@ -1477,8 +1477,8 @@ static int xs_bind4(struct sock_xprt *transport, struct socket *sock)
+ if (port > last)
+ nloop++;
+ } while (err == -EADDRINUSE && nloop != 2);
+- dprintk("RPC: %s %pI4:%u: %s (%d)\n",
+- __func__, &myaddr.sin_addr,
++ dprintk("RPC: %s "NIPQUAD_FMT":%u: %s (%d)\n",
++ __func__, NIPQUAD(myaddr.sin_addr),
+ port, err ? "failed" : "ok", err);
+ return err;
+ }
+@@ -1510,8 +1510,8 @@ static int xs_bind6(struct sock_xprt *transport, struct socket *sock)
+ if (port > last)
+ nloop++;
+ } while (err == -EADDRINUSE && nloop != 2);
+- dprintk("RPC: xs_bind6 %pI6:%u: %s (%d)\n",
+- &myaddr.sin6_addr, port, err ? "failed" : "ok", err);
++ dprintk("RPC: xs_bind6 "NIP6_FMT":%u: %s (%d)\n",
++ NIP6(myaddr.sin6_addr), port, err ? "failed" : "ok", err);
+ return err;
+ }
+
More information about the ewg
mailing list