summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-07-09 15:09:43 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-07-09 15:09:43 -0400
commitbe0c5d8c0bb0023e11f5c6d38e90f7b0f24edb64 (patch)
tree6d7a6e290f8ed2f2ca250965a8debdd9f02a9cc9 /include
parent1f792dd1765e6f047ecd2d5f6a81f025b50d471a (diff)
parent959d921f5eb8878ea16049a7f6e9bcbb6dfbcb88 (diff)
Merge tag 'nfs-for-3.11-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs
Pull NFS client updates from Trond Myklebust: "Feature highlights include: - Add basic client support for NFSv4.2 - Add basic client support for Labeled NFS (selinux for NFSv4.2) - Fix the use of credentials in NFSv4.1 stateful operations, and add support for NFSv4.1 state protection. Bugfix highlights: - Fix another NFSv4 open state recovery race - Fix an NFSv4.1 back channel session regression - Various rpc_pipefs races - Fix another issue with NFSv3 auth negotiation Please note that Labeled NFS does require some additional support from the security subsystem. The relevant changesets have all been reviewed and acked by James Morris." * tag 'nfs-for-3.11-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs: (54 commits) NFS: Set NFS_CS_MIGRATION for NFSv4 mounts NFSv4.1 Refactor nfs4_init_session and nfs4_init_channel_attrs nfs: have NFSv3 try server-specified auth flavors in turn nfs: have nfs_mount fake up a auth_flavs list when the server didn't provide it nfs: move server_authlist into nfs_try_mount_request nfs: refactor "need_mount" code out of nfs_try_mount SUNRPC: PipeFS MOUNT notification optimization for dying clients SUNRPC: split client creation routine into setup and registration SUNRPC: fix races on PipeFS UMOUNT notifications SUNRPC: fix races on PipeFS MOUNT notifications NFSv4.1 use pnfs_device maxcount for the objectlayout gdia_maxcount NFSv4.1 use pnfs_device maxcount for the blocklayout gdia_maxcount NFSv4.1 Fix gdia_maxcount calculation to fit in ca_maxresponsesize NFS: Improve legacy idmapping fallback NFSv4.1 end back channel session draining NFS: Apply v4.1 capabilities to v4.2 NFSv4.1: Clean up layout segment comparison helper names NFSv4.1: layout segment comparison helpers should take 'const' parameters NFSv4: Move the DNS resolver into the NFSv4 module rpc_pipefs: only set rpc_dentry_ops if d_op isn't already set ...
Diffstat (limited to 'include')
-rw-r--r--include/linux/nfs4.h22
-rw-r--r--include/linux/nfs_fs.h27
-rw-r--r--include/linux/nfs_fs_sb.h8
-rw-r--r--include/linux/nfs_xdr.h20
-rw-r--r--include/linux/security.h57
-rw-r--r--include/linux/sunrpc/sched.h20
6 files changed, 125 insertions, 29 deletions
diff --git a/include/linux/nfs4.h b/include/linux/nfs4.h
index 7b8fc73810ad..e36dee52f224 100644
--- a/include/linux/nfs4.h
+++ b/include/linux/nfs4.h
@@ -32,6 +32,15 @@ struct nfs4_acl {
32 struct nfs4_ace aces[0]; 32 struct nfs4_ace aces[0];
33}; 33};
34 34
35#define NFS4_MAXLABELLEN 2048
36
37struct nfs4_label {
38 uint32_t lfs;
39 uint32_t pi;
40 u32 len;
41 char *label;
42};
43
35typedef struct { char data[NFS4_VERIFIER_SIZE]; } nfs4_verifier; 44typedef struct { char data[NFS4_VERIFIER_SIZE]; } nfs4_verifier;
36 45
37struct nfs_stateid4 { 46struct nfs_stateid4 {
@@ -219,6 +228,14 @@ enum nfsstat4 {
219 NFS4ERR_REJECT_DELEG = 10085, /* on callback */ 228 NFS4ERR_REJECT_DELEG = 10085, /* on callback */
220 NFS4ERR_RETURNCONFLICT = 10086, /* outstanding layoutreturn */ 229 NFS4ERR_RETURNCONFLICT = 10086, /* outstanding layoutreturn */
221 NFS4ERR_DELEG_REVOKED = 10087, /* deleg./layout revoked */ 230 NFS4ERR_DELEG_REVOKED = 10087, /* deleg./layout revoked */
231
232 /* nfs42 */
233 NFS4ERR_PARTNER_NOTSUPP = 10088,
234 NFS4ERR_PARTNER_NO_AUTH = 10089,
235 NFS4ERR_METADATA_NOTSUPP = 10090,
236 NFS4ERR_OFFLOAD_DENIED = 10091,
237 NFS4ERR_WRONG_LFS = 10092,
238 NFS4ERR_BADLABEL = 10093,
222}; 239};
223 240
224static inline bool seqid_mutating_err(u32 err) 241static inline bool seqid_mutating_err(u32 err)
@@ -378,6 +395,7 @@ enum lock_type4 {
378#define FATTR4_WORD1_FS_LAYOUT_TYPES (1UL << 30) 395#define FATTR4_WORD1_FS_LAYOUT_TYPES (1UL << 30)
379#define FATTR4_WORD2_LAYOUT_BLKSIZE (1UL << 1) 396#define FATTR4_WORD2_LAYOUT_BLKSIZE (1UL << 1)
380#define FATTR4_WORD2_MDSTHRESHOLD (1UL << 4) 397#define FATTR4_WORD2_MDSTHRESHOLD (1UL << 4)
398#define FATTR4_WORD2_SECURITY_LABEL (1UL << 17)
381 399
382/* MDS threshold bitmap bits */ 400/* MDS threshold bitmap bits */
383#define THRESHOLD_RD (1UL << 0) 401#define THRESHOLD_RD (1UL << 0)
@@ -390,11 +408,15 @@ enum lock_type4 {
390#define NFS4_VERSION 4 408#define NFS4_VERSION 4
391#define NFS4_MINOR_VERSION 0 409#define NFS4_MINOR_VERSION 0
392 410
411#if defined(CONFIG_NFS_V4_2)
412#define NFS4_MAX_MINOR_VERSION 2
413#else
393#if defined(CONFIG_NFS_V4_1) 414#if defined(CONFIG_NFS_V4_1)
394#define NFS4_MAX_MINOR_VERSION 1 415#define NFS4_MAX_MINOR_VERSION 1
395#else 416#else
396#define NFS4_MAX_MINOR_VERSION 0 417#define NFS4_MAX_MINOR_VERSION 0
397#endif /* CONFIG_NFS_V4_1 */ 418#endif /* CONFIG_NFS_V4_1 */
419#endif /* CONFIG_NFS_V4_2 */
398 420
399#define NFS4_DEBUG 1 421#define NFS4_DEBUG 1
400 422
diff --git a/include/linux/nfs_fs.h b/include/linux/nfs_fs.h
index fc01d5cb4cf1..0b176297aaf6 100644
--- a/include/linux/nfs_fs.h
+++ b/include/linux/nfs_fs.h
@@ -207,6 +207,7 @@ struct nfs_inode {
207#define NFS_INO_INVALID_ACL 0x0010 /* cached acls are invalid */ 207#define NFS_INO_INVALID_ACL 0x0010 /* cached acls are invalid */
208#define NFS_INO_REVAL_PAGECACHE 0x0020 /* must revalidate pagecache */ 208#define NFS_INO_REVAL_PAGECACHE 0x0020 /* must revalidate pagecache */
209#define NFS_INO_REVAL_FORCED 0x0040 /* force revalidation ignoring a delegation */ 209#define NFS_INO_REVAL_FORCED 0x0040 /* force revalidation ignoring a delegation */
210#define NFS_INO_INVALID_LABEL 0x0080 /* cached label is invalid */
210 211
211/* 212/*
212 * Bit offsets in flags field 213 * Bit offsets in flags field
@@ -336,7 +337,7 @@ extern void nfs_zap_mapping(struct inode *inode, struct address_space *mapping);
336extern void nfs_zap_caches(struct inode *); 337extern void nfs_zap_caches(struct inode *);
337extern void nfs_invalidate_atime(struct inode *); 338extern void nfs_invalidate_atime(struct inode *);
338extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *, 339extern struct inode *nfs_fhget(struct super_block *, struct nfs_fh *,
339 struct nfs_fattr *); 340 struct nfs_fattr *, struct nfs4_label *);
340extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *); 341extern int nfs_refresh_inode(struct inode *, struct nfs_fattr *);
341extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr); 342extern int nfs_post_op_update_inode(struct inode *inode, struct nfs_fattr *fattr);
342extern int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr); 343extern int nfs_post_op_update_inode_force_wcc(struct inode *inode, struct nfs_fattr *fattr);
@@ -352,10 +353,13 @@ extern int __nfs_revalidate_inode(struct nfs_server *, struct inode *);
352extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping); 353extern int nfs_revalidate_mapping(struct inode *inode, struct address_space *mapping);
353extern int nfs_setattr(struct dentry *, struct iattr *); 354extern int nfs_setattr(struct dentry *, struct iattr *);
354extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr); 355extern void nfs_setattr_update_inode(struct inode *inode, struct iattr *attr);
356extern void nfs_setsecurity(struct inode *inode, struct nfs_fattr *fattr,
357 struct nfs4_label *label);
355extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx); 358extern struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx);
356extern void put_nfs_open_context(struct nfs_open_context *ctx); 359extern void put_nfs_open_context(struct nfs_open_context *ctx);
357extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, fmode_t mode); 360extern struct nfs_open_context *nfs_find_open_context(struct inode *inode, struct rpc_cred *cred, fmode_t mode);
358extern struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, fmode_t f_mode); 361extern struct nfs_open_context *alloc_nfs_open_context(struct dentry *dentry, fmode_t f_mode);
362extern void nfs_inode_attach_open_context(struct nfs_open_context *ctx);
359extern void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx); 363extern void nfs_file_set_open_context(struct file *filp, struct nfs_open_context *ctx);
360extern struct nfs_lock_context *nfs_get_lock_context(struct nfs_open_context *ctx); 364extern struct nfs_lock_context *nfs_get_lock_context(struct nfs_open_context *ctx);
361extern void nfs_put_lock_context(struct nfs_lock_context *l_ctx); 365extern void nfs_put_lock_context(struct nfs_lock_context *l_ctx);
@@ -468,7 +472,8 @@ extern const struct file_operations nfs_dir_operations;
468extern const struct dentry_operations nfs_dentry_operations; 472extern const struct dentry_operations nfs_dentry_operations;
469 473
470extern void nfs_force_lookup_revalidate(struct inode *dir); 474extern void nfs_force_lookup_revalidate(struct inode *dir);
471extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh, struct nfs_fattr *fattr); 475extern int nfs_instantiate(struct dentry *dentry, struct nfs_fh *fh,
476 struct nfs_fattr *fattr, struct nfs4_label *label);
472extern int nfs_may_open(struct inode *inode, struct rpc_cred *cred, int openflags); 477extern int nfs_may_open(struct inode *inode, struct rpc_cred *cred, int openflags);
473extern void nfs_access_zap_cache(struct inode *inode); 478extern void nfs_access_zap_cache(struct inode *inode);
474 479
@@ -497,6 +502,24 @@ extern int nfs_mountpoint_expiry_timeout;
497extern void nfs_release_automount_timer(void); 502extern void nfs_release_automount_timer(void);
498 503
499/* 504/*
505 * linux/fs/nfs/nfs4proc.c
506 */
507#ifdef CONFIG_NFS_V4_SECURITY_LABEL
508extern struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags);
509static inline void nfs4_label_free(struct nfs4_label *label)
510{
511 if (label) {
512 kfree(label->label);
513 kfree(label);
514 }
515 return;
516}
517#else
518static inline struct nfs4_label *nfs4_label_alloc(struct nfs_server *server, gfp_t flags) { return NULL; }
519static inline void nfs4_label_free(void *label) {}
520#endif
521
522/*
500 * linux/fs/nfs/unlink.c 523 * linux/fs/nfs/unlink.c
501 */ 524 */
502extern void nfs_complete_unlink(struct dentry *dentry, struct inode *); 525extern void nfs_complete_unlink(struct dentry *dentry, struct inode *);
diff --git a/include/linux/nfs_fs_sb.h b/include/linux/nfs_fs_sb.h
index 3b7fa2abecca..d2212432c456 100644
--- a/include/linux/nfs_fs_sb.h
+++ b/include/linux/nfs_fs_sb.h
@@ -146,7 +146,12 @@ struct nfs_server {
146 u32 attr_bitmask[3];/* V4 bitmask representing the set 146 u32 attr_bitmask[3];/* V4 bitmask representing the set
147 of attributes supported on this 147 of attributes supported on this
148 filesystem */ 148 filesystem */
149 u32 cache_consistency_bitmask[2]; 149 u32 attr_bitmask_nl[3];
150 /* V4 bitmask representing the
151 set of attributes supported
152 on this filesystem excluding
153 the label support bit. */
154 u32 cache_consistency_bitmask[3];
150 /* V4 bitmask representing the subset 155 /* V4 bitmask representing the subset
151 of change attribute, size, ctime 156 of change attribute, size, ctime
152 and mtime attributes supported by 157 and mtime attributes supported by
@@ -200,5 +205,6 @@ struct nfs_server {
200#define NFS_CAP_UIDGID_NOMAP (1U << 15) 205#define NFS_CAP_UIDGID_NOMAP (1U << 15)
201#define NFS_CAP_STATEID_NFSV41 (1U << 16) 206#define NFS_CAP_STATEID_NFSV41 (1U << 16)
202#define NFS_CAP_ATOMIC_OPEN_V1 (1U << 17) 207#define NFS_CAP_ATOMIC_OPEN_V1 (1U << 17)
208#define NFS_CAP_SECURITY_LABEL (1U << 18)
203 209
204#endif 210#endif
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 104b62f23ee0..8651574a305b 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -101,6 +101,7 @@ struct nfs_fattr {
101#define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 22) 101#define NFS_ATTR_FATTR_MOUNTED_ON_FILEID (1U << 22)
102#define NFS_ATTR_FATTR_OWNER_NAME (1U << 23) 102#define NFS_ATTR_FATTR_OWNER_NAME (1U << 23)
103#define NFS_ATTR_FATTR_GROUP_NAME (1U << 24) 103#define NFS_ATTR_FATTR_GROUP_NAME (1U << 24)
104#define NFS_ATTR_FATTR_V4_SECURITY_LABEL (1U << 25)
104 105
105#define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \ 106#define NFS_ATTR_FATTR (NFS_ATTR_FATTR_TYPE \
106 | NFS_ATTR_FATTR_MODE \ 107 | NFS_ATTR_FATTR_MODE \
@@ -120,7 +121,8 @@ struct nfs_fattr {
120#define NFS_ATTR_FATTR_V3 (NFS_ATTR_FATTR \ 121#define NFS_ATTR_FATTR_V3 (NFS_ATTR_FATTR \
121 | NFS_ATTR_FATTR_SPACE_USED) 122 | NFS_ATTR_FATTR_SPACE_USED)
122#define NFS_ATTR_FATTR_V4 (NFS_ATTR_FATTR \ 123#define NFS_ATTR_FATTR_V4 (NFS_ATTR_FATTR \
123 | NFS_ATTR_FATTR_SPACE_USED) 124 | NFS_ATTR_FATTR_SPACE_USED \
125 | NFS_ATTR_FATTR_V4_SECURITY_LABEL)
124 126
125/* 127/*
126 * Info on the file system 128 * Info on the file system
@@ -246,6 +248,7 @@ struct nfs4_layoutget_res {
246struct nfs4_layoutget { 248struct nfs4_layoutget {
247 struct nfs4_layoutget_args args; 249 struct nfs4_layoutget_args args;
248 struct nfs4_layoutget_res res; 250 struct nfs4_layoutget_res res;
251 struct rpc_cred *cred;
249 gfp_t gfp_flags; 252 gfp_t gfp_flags;
250}; 253};
251 254
@@ -347,6 +350,7 @@ struct nfs_openargs {
347 const u32 * open_bitmap; 350 const u32 * open_bitmap;
348 __u32 claim; 351 __u32 claim;
349 enum createmode4 createmode; 352 enum createmode4 createmode;
353 const struct nfs4_label *label;
350}; 354};
351 355
352struct nfs_openres { 356struct nfs_openres {
@@ -356,6 +360,7 @@ struct nfs_openres {
356 struct nfs4_change_info cinfo; 360 struct nfs4_change_info cinfo;
357 __u32 rflags; 361 __u32 rflags;
358 struct nfs_fattr * f_attr; 362 struct nfs_fattr * f_attr;
363 struct nfs4_label *f_label;
359 struct nfs_seqid * seqid; 364 struct nfs_seqid * seqid;
360 const struct nfs_server *server; 365 const struct nfs_server *server;
361 fmode_t delegation_type; 366 fmode_t delegation_type;
@@ -598,6 +603,7 @@ struct nfs_entry {
598 int eof; 603 int eof;
599 struct nfs_fh * fh; 604 struct nfs_fh * fh;
600 struct nfs_fattr * fattr; 605 struct nfs_fattr * fattr;
606 struct nfs4_label *label;
601 unsigned char d_type; 607 unsigned char d_type;
602 struct nfs_server * server; 608 struct nfs_server * server;
603}; 609};
@@ -630,6 +636,7 @@ struct nfs_setattrargs {
630 struct iattr * iap; 636 struct iattr * iap;
631 const struct nfs_server * server; /* Needed for name mapping */ 637 const struct nfs_server * server; /* Needed for name mapping */
632 const u32 * bitmask; 638 const u32 * bitmask;
639 const struct nfs4_label *label;
633}; 640};
634 641
635struct nfs_setaclargs { 642struct nfs_setaclargs {
@@ -665,6 +672,7 @@ struct nfs_getaclres {
665struct nfs_setattrres { 672struct nfs_setattrres {
666 struct nfs4_sequence_res seq_res; 673 struct nfs4_sequence_res seq_res;
667 struct nfs_fattr * fattr; 674 struct nfs_fattr * fattr;
675 struct nfs4_label *label;
668 const struct nfs_server * server; 676 const struct nfs_server * server;
669}; 677};
670 678
@@ -862,6 +870,7 @@ struct nfs4_create_arg {
862 const struct iattr * attrs; 870 const struct iattr * attrs;
863 const struct nfs_fh * dir_fh; 871 const struct nfs_fh * dir_fh;
864 const u32 * bitmask; 872 const u32 * bitmask;
873 const struct nfs4_label *label;
865}; 874};
866 875
867struct nfs4_create_res { 876struct nfs4_create_res {
@@ -869,6 +878,7 @@ struct nfs4_create_res {
869 const struct nfs_server * server; 878 const struct nfs_server * server;
870 struct nfs_fh * fh; 879 struct nfs_fh * fh;
871 struct nfs_fattr * fattr; 880 struct nfs_fattr * fattr;
881 struct nfs4_label *label;
872 struct nfs4_change_info dir_cinfo; 882 struct nfs4_change_info dir_cinfo;
873}; 883};
874 884
@@ -893,6 +903,7 @@ struct nfs4_getattr_res {
893 struct nfs4_sequence_res seq_res; 903 struct nfs4_sequence_res seq_res;
894 const struct nfs_server * server; 904 const struct nfs_server * server;
895 struct nfs_fattr * fattr; 905 struct nfs_fattr * fattr;
906 struct nfs4_label *label;
896}; 907};
897 908
898struct nfs4_link_arg { 909struct nfs4_link_arg {
@@ -907,6 +918,7 @@ struct nfs4_link_res {
907 struct nfs4_sequence_res seq_res; 918 struct nfs4_sequence_res seq_res;
908 const struct nfs_server * server; 919 const struct nfs_server * server;
909 struct nfs_fattr * fattr; 920 struct nfs_fattr * fattr;
921 struct nfs4_label *label;
910 struct nfs4_change_info cinfo; 922 struct nfs4_change_info cinfo;
911 struct nfs_fattr * dir_attr; 923 struct nfs_fattr * dir_attr;
912}; 924};
@@ -924,6 +936,7 @@ struct nfs4_lookup_res {
924 const struct nfs_server * server; 936 const struct nfs_server * server;
925 struct nfs_fattr * fattr; 937 struct nfs_fattr * fattr;
926 struct nfs_fh * fh; 938 struct nfs_fh * fh;
939 struct nfs4_label *label;
927}; 940};
928 941
929struct nfs4_lookup_root_arg { 942struct nfs4_lookup_root_arg {
@@ -1366,11 +1379,12 @@ struct nfs_rpc_ops {
1366 struct dentry *(*try_mount) (int, const char *, struct nfs_mount_info *, 1379 struct dentry *(*try_mount) (int, const char *, struct nfs_mount_info *,
1367 struct nfs_subversion *); 1380 struct nfs_subversion *);
1368 int (*getattr) (struct nfs_server *, struct nfs_fh *, 1381 int (*getattr) (struct nfs_server *, struct nfs_fh *,
1369 struct nfs_fattr *); 1382 struct nfs_fattr *, struct nfs4_label *);
1370 int (*setattr) (struct dentry *, struct nfs_fattr *, 1383 int (*setattr) (struct dentry *, struct nfs_fattr *,
1371 struct iattr *); 1384 struct iattr *);
1372 int (*lookup) (struct inode *, struct qstr *, 1385 int (*lookup) (struct inode *, struct qstr *,
1373 struct nfs_fh *, struct nfs_fattr *); 1386 struct nfs_fh *, struct nfs_fattr *,
1387 struct nfs4_label *);
1374 int (*access) (struct inode *, struct nfs_access_entry *); 1388 int (*access) (struct inode *, struct nfs_access_entry *);
1375 int (*readlink)(struct inode *, struct page *, unsigned int, 1389 int (*readlink)(struct inode *, struct page *, unsigned int,
1376 unsigned int); 1390 unsigned int);
diff --git a/include/linux/security.h b/include/linux/security.h
index 40560f41e3d5..7ce53ae1266b 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -26,6 +26,7 @@
26#include <linux/capability.h> 26#include <linux/capability.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/err.h> 28#include <linux/err.h>
29#include <linux/string.h>
29 30
30struct linux_binprm; 31struct linux_binprm;
31struct cred; 32struct cred;
@@ -60,6 +61,9 @@ struct mm_struct;
60#define SECURITY_CAP_NOAUDIT 0 61#define SECURITY_CAP_NOAUDIT 0
61#define SECURITY_CAP_AUDIT 1 62#define SECURITY_CAP_AUDIT 1
62 63
64/* LSM Agnostic defines for sb_set_mnt_opts */
65#define SECURITY_LSM_NATIVE_LABELS 1
66
63struct ctl_table; 67struct ctl_table;
64struct audit_krule; 68struct audit_krule;
65struct user_namespace; 69struct user_namespace;
@@ -306,6 +310,15 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
306 * Parse a string of security data filling in the opts structure 310 * Parse a string of security data filling in the opts structure
307 * @options string containing all mount options known by the LSM 311 * @options string containing all mount options known by the LSM
308 * @opts binary data structure usable by the LSM 312 * @opts binary data structure usable by the LSM
313 * @dentry_init_security:
314 * Compute a context for a dentry as the inode is not yet available
315 * since NFSv4 has no label backed by an EA anyway.
316 * @dentry dentry to use in calculating the context.
317 * @mode mode used to determine resource type.
318 * @name name of the last path component used to create file
319 * @ctx pointer to place the pointer to the resulting context in.
320 * @ctxlen point to place the length of the resulting context.
321 *
309 * 322 *
310 * Security hooks for inode operations. 323 * Security hooks for inode operations.
311 * 324 *
@@ -1313,6 +1326,13 @@ static inline void security_free_mnt_opts(struct security_mnt_opts *opts)
1313 * @pages contains the number of pages. 1326 * @pages contains the number of pages.
1314 * Return 0 if permission is granted. 1327 * Return 0 if permission is granted.
1315 * 1328 *
1329 * @ismaclabel:
1330 * Check if the extended attribute specified by @name
1331 * represents a MAC label. Returns 1 if name is a MAC
1332 * attribute otherwise returns 0.
1333 * @name full extended attribute name to check against
1334 * LSM as a MAC label.
1335 *
1316 * @secid_to_secctx: 1336 * @secid_to_secctx:
1317 * Convert secid to security context. If secdata is NULL the length of 1337 * Convert secid to security context. If secdata is NULL the length of
1318 * the result will be returned in seclen, but no secdata will be returned. 1338 * the result will be returned in seclen, but no secdata will be returned.
@@ -1440,10 +1460,16 @@ struct security_operations {
1440 int (*sb_pivotroot) (struct path *old_path, 1460 int (*sb_pivotroot) (struct path *old_path,
1441 struct path *new_path); 1461 struct path *new_path);
1442 int (*sb_set_mnt_opts) (struct super_block *sb, 1462 int (*sb_set_mnt_opts) (struct super_block *sb,
1443 struct security_mnt_opts *opts); 1463 struct security_mnt_opts *opts,
1464 unsigned long kern_flags,
1465 unsigned long *set_kern_flags);
1444 int (*sb_clone_mnt_opts) (const struct super_block *oldsb, 1466 int (*sb_clone_mnt_opts) (const struct super_block *oldsb,
1445 struct super_block *newsb); 1467 struct super_block *newsb);
1446 int (*sb_parse_opts_str) (char *options, struct security_mnt_opts *opts); 1468 int (*sb_parse_opts_str) (char *options, struct security_mnt_opts *opts);
1469 int (*dentry_init_security) (struct dentry *dentry, int mode,
1470 struct qstr *name, void **ctx,
1471 u32 *ctxlen);
1472
1447 1473
1448#ifdef CONFIG_SECURITY_PATH 1474#ifdef CONFIG_SECURITY_PATH
1449 int (*path_unlink) (struct path *dir, struct dentry *dentry); 1475 int (*path_unlink) (struct path *dir, struct dentry *dentry);
@@ -1591,6 +1617,7 @@ struct security_operations {
1591 1617
1592 int (*getprocattr) (struct task_struct *p, char *name, char **value); 1618 int (*getprocattr) (struct task_struct *p, char *name, char **value);
1593 int (*setprocattr) (struct task_struct *p, char *name, void *value, size_t size); 1619 int (*setprocattr) (struct task_struct *p, char *name, void *value, size_t size);
1620 int (*ismaclabel) (const char *name);
1594 int (*secid_to_secctx) (u32 secid, char **secdata, u32 *seclen); 1621 int (*secid_to_secctx) (u32 secid, char **secdata, u32 *seclen);
1595 int (*secctx_to_secid) (const char *secdata, u32 seclen, u32 *secid); 1622 int (*secctx_to_secid) (const char *secdata, u32 seclen, u32 *secid);
1596 void (*release_secctx) (char *secdata, u32 seclen); 1623 void (*release_secctx) (char *secdata, u32 seclen);
@@ -1726,10 +1753,16 @@ int security_sb_mount(const char *dev_name, struct path *path,
1726 const char *type, unsigned long flags, void *data); 1753 const char *type, unsigned long flags, void *data);
1727int security_sb_umount(struct vfsmount *mnt, int flags); 1754int security_sb_umount(struct vfsmount *mnt, int flags);
1728int security_sb_pivotroot(struct path *old_path, struct path *new_path); 1755int security_sb_pivotroot(struct path *old_path, struct path *new_path);
1729int security_sb_set_mnt_opts(struct super_block *sb, struct security_mnt_opts *opts); 1756int security_sb_set_mnt_opts(struct super_block *sb,
1757 struct security_mnt_opts *opts,
1758 unsigned long kern_flags,
1759 unsigned long *set_kern_flags);
1730int security_sb_clone_mnt_opts(const struct super_block *oldsb, 1760int security_sb_clone_mnt_opts(const struct super_block *oldsb,
1731 struct super_block *newsb); 1761 struct super_block *newsb);
1732int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts); 1762int security_sb_parse_opts_str(char *options, struct security_mnt_opts *opts);
1763int security_dentry_init_security(struct dentry *dentry, int mode,
1764 struct qstr *name, void **ctx,
1765 u32 *ctxlen);
1733 1766
1734int security_inode_alloc(struct inode *inode); 1767int security_inode_alloc(struct inode *inode);
1735void security_inode_free(struct inode *inode); 1768void security_inode_free(struct inode *inode);
@@ -1841,6 +1874,7 @@ void security_d_instantiate(struct dentry *dentry, struct inode *inode);
1841int security_getprocattr(struct task_struct *p, char *name, char **value); 1874int security_getprocattr(struct task_struct *p, char *name, char **value);
1842int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size); 1875int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size);
1843int security_netlink_send(struct sock *sk, struct sk_buff *skb); 1876int security_netlink_send(struct sock *sk, struct sk_buff *skb);
1877int security_ismaclabel(const char *name);
1844int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen); 1878int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen);
1845int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid); 1879int security_secctx_to_secid(const char *secdata, u32 seclen, u32 *secid);
1846void security_release_secctx(char *secdata, u32 seclen); 1880void security_release_secctx(char *secdata, u32 seclen);
@@ -2012,7 +2046,9 @@ static inline int security_sb_pivotroot(struct path *old_path,
2012} 2046}
2013 2047
2014static inline int security_sb_set_mnt_opts(struct super_block *sb, 2048static inline int security_sb_set_mnt_opts(struct super_block *sb,
2015 struct security_mnt_opts *opts) 2049 struct security_mnt_opts *opts,
2050 unsigned long kern_flags,
2051 unsigned long *set_kern_flags)
2016{ 2052{
2017 return 0; 2053 return 0;
2018} 2054}
@@ -2036,6 +2072,16 @@ static inline int security_inode_alloc(struct inode *inode)
2036static inline void security_inode_free(struct inode *inode) 2072static inline void security_inode_free(struct inode *inode)
2037{ } 2073{ }
2038 2074
2075static inline int security_dentry_init_security(struct dentry *dentry,
2076 int mode,
2077 struct qstr *name,
2078 void **ctx,
2079 u32 *ctxlen)
2080{
2081 return -EOPNOTSUPP;
2082}
2083
2084
2039static inline int security_inode_init_security(struct inode *inode, 2085static inline int security_inode_init_security(struct inode *inode,
2040 struct inode *dir, 2086 struct inode *dir,
2041 const struct qstr *qstr, 2087 const struct qstr *qstr,
@@ -2521,6 +2567,11 @@ static inline int security_netlink_send(struct sock *sk, struct sk_buff *skb)
2521 return cap_netlink_send(sk, skb); 2567 return cap_netlink_send(sk, skb);
2522} 2568}
2523 2569
2570static inline int security_ismaclabel(const char *name)
2571{
2572 return 0;
2573}
2574
2524static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen) 2575static inline int security_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
2525{ 2576{
2526 return -EOPNOTSUPP; 2577 return -EOPNOTSUPP;
diff --git a/include/linux/sunrpc/sched.h b/include/linux/sunrpc/sched.h
index 84ca436b76c2..6d870353674a 100644
--- a/include/linux/sunrpc/sched.h
+++ b/include/linux/sunrpc/sched.h
@@ -88,15 +88,6 @@ struct rpc_task {
88 tk_rebind_retry : 2; 88 tk_rebind_retry : 2;
89}; 89};
90 90
91/* support walking a list of tasks on a wait queue */
92#define task_for_each(task, pos, head) \
93 list_for_each(pos, head) \
94 if ((task=list_entry(pos, struct rpc_task, u.tk_wait.list)),1)
95
96#define task_for_first(task, head) \
97 if (!list_empty(head) && \
98 ((task=list_entry((head)->next, struct rpc_task, u.tk_wait.list)),1))
99
100typedef void (*rpc_action)(struct rpc_task *); 91typedef void (*rpc_action)(struct rpc_task *);
101 92
102struct rpc_call_ops { 93struct rpc_call_ops {
@@ -238,7 +229,6 @@ struct rpc_task *rpc_wake_up_first(struct rpc_wait_queue *,
238 bool (*)(struct rpc_task *, void *), 229 bool (*)(struct rpc_task *, void *),
239 void *); 230 void *);
240void rpc_wake_up_status(struct rpc_wait_queue *, int); 231void rpc_wake_up_status(struct rpc_wait_queue *, int);
241int rpc_queue_empty(struct rpc_wait_queue *);
242void rpc_delay(struct rpc_task *, unsigned long); 232void rpc_delay(struct rpc_task *, unsigned long);
243void * rpc_malloc(struct rpc_task *, size_t); 233void * rpc_malloc(struct rpc_task *, size_t);
244void rpc_free(void *); 234void rpc_free(void *);
@@ -259,16 +249,6 @@ static inline int rpc_wait_for_completion_task(struct rpc_task *task)
259 return __rpc_wait_for_completion_task(task, NULL); 249 return __rpc_wait_for_completion_task(task, NULL);
260} 250}
261 251
262static inline void rpc_task_set_priority(struct rpc_task *task, unsigned char prio)
263{
264 task->tk_priority = prio - RPC_PRIORITY_LOW;
265}
266
267static inline int rpc_task_has_priority(struct rpc_task *task, unsigned char prio)
268{
269 return (task->tk_priority + RPC_PRIORITY_LOW == prio);
270}
271
272#if defined(RPC_DEBUG) || defined (RPC_TRACEPOINTS) 252#if defined(RPC_DEBUG) || defined (RPC_TRACEPOINTS)
273static inline const char * rpc_qname(const struct rpc_wait_queue *q) 253static inline const char * rpc_qname(const struct rpc_wait_queue *q)
274{ 254{