NFS Bugfixes for 2.6.20-rc5
Subsystems (3)
cover NFS Bugfixes for 2.6.20-rc5
The following series fixes 3 bugs in the 2.6.20-rc5 NFS client.
- Fix Oops in rpc_call_sync()
- Fix races in nfs_revalidate_mapping()
- Ensure we support selinux xattrs
Cheers,
Trond
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 1/3 NFS: Fix Oops in rpc_call_sync()
From: Trond Myklebust <[email protected]>
Fix the Oops in http://bugzilla.linux-nfs.org/show_bug.cgi?id=138
We shouldn't be calling rpc_release_task() for tasks that are not active.
---
include/linux/sunrpc/sched.h | 1 - net/sunrpc/clnt.c | 8 +++----- net/sunrpc/sched.c | 3 ++- 3 files changed, 5 insertions(+), 7 deletions(-)
include/linux/sunrpc/sched.h +0 -1
@@ -250,7 +250,6 @@ void rpc_init_task(struct rpc_task *tas int flags, const struct rpc_call_ops *ops, void *data);void rpc_put_task (struct rpc_task *); -void rpc_release_task (struct rpc_task *);void rpc_exit_task (struct rpc_task *);void rpc_release_calldata (const struct rpc_call_ops *,void *);void rpc_killall_tasks (struct rpc_clnt *);
net/sunrpc/clnt.c +3 -5
@@ -490,16 +490,14 @@ int rpc_call_sync(struct rpc_clnt *clnt,/* Set up the call info struct and execute the task */ status = task->tk_status; -if (status !=0 ) { -rpc_release_task (task); +if (status !=0 ) goto out; - }atomic_inc (&task->tk_count); status =rpc_execute (task);if (status ==0 ) status = task->tk_status; -rpc_put_task (task); out: +rpc_put_task (task);rpc_restore_sigmask (&oldset);return status; }
@@ -537,7 +535,7 @@ rpc_call_async(struct rpc_clnt *clnt, stif (status ==0 )rpc_execute (task);else -rpc_release_task (task); +rpc_put_task (task);rpc_restore_sigmask (&oldset);return status;
net/sunrpc/sched.c +2 -1
@@ -42,6 +42,7 @@ static mempool_t *rpc_buffer_mempool __rstatic void __rpc_default_timer (struct rpc_task *task);static void rpciod_killall (void );static void rpc_async_schedule (struct work_struct *); +static void rpc_release_task (struct rpc_task *task);/* * RPC tasks sit here while waiting for conditions to improve.
@@ -896,7 +897,7 @@ void rpc_put_task(struct rpc_task *task) }EXPORT_SYMBOL (rpc_put_task); -void rpc_release_task (struct rpc_task *task) +static void rpc_release_task (struct rpc_task *task) {#ifdef RPC_DEBUG BUG_ON (task->tk_magic !=RPC_TASK_MAGIC_ID );
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 2/3 NFS: Fix races in nfs_revalidate_mapping()
In reply to Trond MyklebustFrom: Trond Myklebust <[email protected]>
Prevent the call to invalidate_inode_pages2() from racing with file writes by taking the inode->i_mutex across the page cache flush and invalidate.
---
fs/nfs/dir.c | 2 - fs/nfs/inode.c | 97 +++++++++++++++++++++++++++++++++--------------- fs/nfs/symlink.c | 4 +- include/linux/nfs_fs.h | 1 4 files changed, 72 insertions(+), 32 deletions(-)
fs/nfs/dir.c +1 -1
@@ -532,7 +532,7 @@ static int nfs_readdir(struct file *filplock_kernel (); - res =nfs_revalidate_mapping (inode, filp->f_mapping); + res =nfs_revalidate_mapping_nolock (inode, filp->f_mapping);if (res <0 ) {unlock_kernel ();return res;
fs/nfs/inode.c +67 -30
116 lines not on this page · raw message
fs/nfs/symlink.c +3 -1
@@ -50,7 +50,9 @@ static void *nfs_follow_link(struct dent {struct inode *inode = dentry->d_inode;struct page *page; -void *err =ERR_PTR (nfs_revalidate_mapping (inode, inode->i_mapping)); +void *err; + + err =ERR_PTR (nfs_revalidate_mapping_nolock (inode, inode->i_mapping));if (err) goto read_failed; page = read_cache_page(&inode->i_data, 0,
include/linux/nfs_fs.h +1 -0
@@ -308,6 +308,7 @@ extern int nfs_attribute_timeout(structextern int nfs_revalidate_inode (struct nfs_server *server,struct inode *inode);extern int __nfs_revalidate_inode (struct nfs_server *,struct inode *);extern int nfs_revalidate_mapping (struct inode *inode,struct address_space *mapping); +extern int nfs_revalidate_mapping_nolock (struct inode *inode,struct address_space *mapping);extern int nfs_setattr (struct dentry *,struct iattr *);extern void nfs_setattr_update_inode (struct inode *inode,struct iattr *attr);extern void nfs_begin_attr_update (struct inode *);
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
PATCH 3/3 NFS: Ensure we support selinux xattrs
In reply to Trond MyklebustFrom: Trond Myklebust <[email protected]>
Some programs (e.g. GNU "cp") are currently crashing because NFS allows you to inquire about SELinux security attributes (vfs_getxattr() automatically handles this), but returns -EOPNOTSUPP when they later attempt to set the SELinux security attributes.
The following patch just ensures that we pass the request to set security attributes on to the default SELinux handler.
---
fs/nfs/nfs3acl.c | 13 +++++++++++++ fs/nfs/nfs4proc.c | 14 ++++++++++++++ 2 files changed, 27 insertions(+), 0 deletions(-)
fs/nfs/nfs3acl.c +13 -0
@@ -4,6 +4,9 @@ #include <linux/nfs3.h>#include <linux/nfs_fs.h> #include <linux/posix_acl_xattr.h> #include <linux/nfsacl.h> +#include <linux/security.h> +#include <linux/xattr.h> +#include <linux/fsnotify.h> #define NFSDBG_FACILITY NFSDBG_PROC
@@ -82,6 +85,16 @@ int nfs3_setxattr(struct dentry *dentry,struct posix_acl *acl;int type, error; +/* Selinux support */ +if (!strncmp (name,XATTR_SECURITY_PREFIX ,XATTR_SECURITY_PREFIX_LEN )) { +const char *suffix = name +XATTR_SECURITY_PREFIX_LEN ; + error =security_inode_setsecurity (inode, suffix, value, + size, flags); +if (!error) +fsnotify_xattr (dentry); +return error; + } +if (strcmp (name,POSIX_ACL_XATTR_ACCESS ) ==0 ) type =ACL_TYPE_ACCESS ;else if (strcmp (name,POSIX_ACL_XATTR_DEFAULT ) ==0 )
fs/nfs/nfs4proc.c +14 -0
@@ -48,6 +48,9 @@ #include <linux/nfs_page.h>#include <linux/smp_lock.h> #include <linux/namei.h> #include <linux/mount.h> +#include <linux/security.h> +#include <linux/xattr.h> +#include <linux/fsnotify.h> #include "nfs4_fs.h" #include "delegation.h"
@@ -3547,6 +3550,17 @@ int nfs4_setxattr(struct dentry *dentry, {struct inode *inode = dentry->d_inode; +/* Selinux support */ +if (!strncmp (key,XATTR_SECURITY_PREFIX ,XATTR_SECURITY_PREFIX_LEN )) { +const char *suffix = key +XATTR_SECURITY_PREFIX_LEN ; +int error; + error =security_inode_setsecurity (inode, suffix, buf, + buflen, flags); +if (!error) +fsnotify_xattr (dentry); +return error; + } +if (strcmp (key,XATTR_NAME_NFSV4_ACL ) !=0 )return -EOPNOTSUPP ;
Re: [PATCH 3/3] NFS: Ensure we support selinux xattrs
Quoted 9 lines · Trond Myklebust
From: Trond Myklebust <[email protected]>
Some programs (e.g. GNU "cp") are currently crashing because NFS allows you to inquire about SELinux security attributes (
vfs_getxattr()automatically handles this), but returns-EOPNOTSUPPwhen they later attempt to set the SELinux security attributes.The following patch just ensures that we pass the request to set security attributes on to the default SELinux handler.
That seems like a bug in cp, and it can happen under other circumstances as well (mount with context= option).
I don't think you want to just set the incore inode security state on the client side, as that won't be preserved.
Quoted 70 lines
Signed-off-by Trond Myklebust <[email protected]>---
fs/nfs/nfs3acl.c | 13 +++++++++++++ fs/nfs/nfs4proc.c | 14 ++++++++++++++ 2 files changed, 27 insertions(+), 0 deletions(-)fs/nfs/nfs3acl.c +13
-0@@ -4,6 +4,9 @@ #include <linux/nfs3.h>#include <linux/nfs_fs.h> #include <linux/posix_acl_xattr.h> #include <linux/nfsacl.h> +#include <linux/security.h> +#include <linux/xattr.h> +#include <linux/fsnotify.h> #define NFSDBG_FACILITY NFSDBG_PROC@@ -82,6 +85,16 @@ int nfs3_setxattr(struct dentry *dentry,struct posix_acl *acl;int type, error; +/* Selinux support */ +if (!strncmp (name,XATTR_SECURITY_PREFIX ,XATTR_SECURITY_PREFIX_LEN )) { +const char *suffix = name +XATTR_SECURITY_PREFIX_LEN ; + error =security_inode_setsecurity (inode, suffix, value, + size, flags); +if (!error) +fsnotify_xattr (dentry); +return error; + } +if (strcmp (name,POSIX_ACL_XATTR_ACCESS ) ==0 ) type =ACL_TYPE_ACCESS ;else if (strcmp (name,POSIX_ACL_XATTR_DEFAULT ) ==0 )fs/nfs/nfs4proc.c +14
-0@@ -48,6 +48,9 @@ #include <linux/nfs_page.h>#include <linux/smp_lock.h> #include <linux/namei.h> #include <linux/mount.h> +#include <linux/security.h> +#include <linux/xattr.h> +#include <linux/fsnotify.h> #include "nfs4_fs.h" #include "delegation.h" @@ -3547,6 +3550,17 @@ int nfs4_setxattr(struct dentry *dentry, {struct inode *inode = dentry->d_inode; +/* Selinux support */ +if (!strncmp (key,XATTR_SECURITY_PREFIX ,XATTR_SECURITY_PREFIX_LEN )) { +const char *suffix = key +XATTR_SECURITY_PREFIX_LEN ; +int error; + error =security_inode_setsecurity (inode, suffix, buf, + buflen, flags); +if (!error) +fsnotify_xattr (dentry); +return error; + } +if (strcmp (key,XATTR_NAME_NFSV4_ACL ) !=0 )return -EOPNOTSUPP ;
Signature · 12 lines
Stephen Smalley National Security Agency ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ NFS maillist - [email protected] https://lists.sourceforge.net/lists/listinfo/nfs
Re: [PATCH 3/3] NFS: Ensure we support selinux xattrs
Quoted 3 lines · Stephen Smalley
I don't think you want to just set the incore inode security state on the client side, as that won't be preserved.
I agree. The fix seems much worse than the problem.
It doesn't seem to be a kernel bug (except insofar that you can argue that enabling ACL's at all is a bug), and it also doesn't look like a regression.
Linus
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs
Re: [NFS] [PATCH 3/3] NFS: Ensure we support selinux xattrs
Quoted 11 lines · Linus Torvalds
Quoted 3 lines · Stephen Smalley
I don't think you want to just set the incore inode security state on the client side, as that won't be preserved.
I agree. The fix seems much worse than the problem.
It doesn't seem to be a kernel bug (except insofar that you can argue that enabling ACL's at all is a bug), and it also doesn't look like a regression.
Fair enough. Please drop this patch then.
Trond