X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=blobdiff_plain;f=lustre%2Fllite%2Fllite_internal.h;h=96770adb76465f5698ebb84425726b12b2be799c;hp=da95fb6b91a3b942b19289877b0e14fdbdc5acca;hb=a259082d66ba482aa4044abd1b41ac4219585473;hpb=9d06de39731ae16d030cda672ae771496d4f0952 diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h index da95fb6..96770ad 100644 --- a/lustre/llite/llite_internal.h +++ b/lustre/llite/llite_internal.h @@ -118,10 +118,6 @@ struct ll_inode_info { /* master inode fid for stripe directory */ struct lu_fid lli_pfid; - /* open count currently used by capability only, indicate whether - * capability needs renewal */ - atomic_t lli_open_count; - /* We need all three because every inode may be opened in different * modes */ struct obd_client_handle *lli_mds_read_och; @@ -295,9 +291,11 @@ int ll_xattr_cache_get(struct inode *inode, size_t size, __u64 valid); -int ll_init_security(struct dentry *dentry, - struct inode *inode, - struct inode *dir); +int ll_dentry_init_security(struct dentry *dentry, int mode, struct qstr *name, + const char **secctx_name, void **secctx, + __u32 *secctx_size); +int ll_inode_init_security(struct dentry *dentry, struct inode *inode, + struct inode *dir); /* * Locking to guarantee consistency of non-atomic updates to long long i_size, @@ -317,10 +315,10 @@ static inline struct ll_inode_info *ll_i2info(struct inode *inode) } /* default to about 64M of readahead on a given system. */ -#define SBI_DEFAULT_READAHEAD_MAX (64UL << (20 - PAGE_CACHE_SHIFT)) +#define SBI_DEFAULT_READAHEAD_MAX (64UL << (20 - PAGE_SHIFT)) /* default to read-ahead full files smaller than 2MB on the second read */ -#define SBI_DEFAULT_READAHEAD_WHOLE_MAX (2UL << (20 - PAGE_CACHE_SHIFT)) +#define SBI_DEFAULT_READAHEAD_WHOLE_MAX (2UL << (20 - PAGE_SHIFT)) enum ra_stat { RA_STAT_HIT = 0, @@ -428,6 +426,7 @@ enum stats_track_type { #define LL_SBI_ALWAYS_PING 0x200000 /* always ping even if server * suppress_pings */ #define LL_SBI_FAST_READ 0x400000 /* fast read support */ +#define LL_SBI_FILE_SECCTX 0x800000 /* set file security context at create */ #define LL_SBI_FLAGS { \ "nolck", \ @@ -453,6 +452,7 @@ enum stats_track_type { "norootsquash", \ "always_ping", \ "fast_read", \ + "file_secctx", \ } /* This is embedded into llite super-blocks to keep track of connect @@ -638,8 +638,6 @@ struct ll_file_data { struct list_head fd_lccs; /* list of ll_cl_context */ }; -extern spinlock_t inode_lock; - extern struct proc_dir_entry *proc_lustre_fs_root; static inline struct inode *ll_info2i(struct ll_inode_info *lli) @@ -655,7 +653,7 @@ static inline int ll_need_32bit_api(struct ll_sb_info *sbi) #if BITS_PER_LONG == 32 return 1; #elif defined(CONFIG_COMPAT) - return unlikely(is_compat_task() || (sbi->ll_flags & LL_SBI_32BIT_API)); + return unlikely(in_compat_syscall() || (sbi->ll_flags & LL_SBI_32BIT_API)); #else return unlikely(sbi->ll_flags & LL_SBI_32BIT_API); #endif @@ -1013,7 +1011,7 @@ struct vm_area_struct *our_vma(struct mm_struct *mm, unsigned long addr, static inline void ll_invalidate_page(struct page *vmpage) { struct address_space *mapping = vmpage->mapping; - loff_t offset = vmpage->index << PAGE_CACHE_SHIFT; + loff_t offset = vmpage->index << PAGE_SHIFT; LASSERT(PageLocked(vmpage)); if (mapping == NULL) @@ -1023,7 +1021,7 @@ static inline void ll_invalidate_page(struct page *vmpage) * truncate_complete_page() calls * a_ops->invalidatepage()->cl_page_delete()->vvp_page_delete(). */ - ll_teardown_mmaps(mapping, offset, offset + PAGE_CACHE_SIZE); + ll_teardown_mmaps(mapping, offset, offset + PAGE_SIZE); truncate_complete_page(mapping, vmpage); } @@ -1305,7 +1303,7 @@ extern ssize_t ll_direct_rw_pages(const struct lu_env *env, struct cl_io *io, static inline int ll_file_nolock(const struct file *file) { struct ll_file_data *fd = LUSTRE_FPRIVATE(file); - struct inode *inode = file->f_path.dentry->d_inode; + struct inode *inode = file_inode((struct file *)file); LASSERT(fd != NULL); return ((fd->fd_flags & LL_FILE_IGNORE_LOCK) || @@ -1328,20 +1326,19 @@ static inline void ll_set_lock_data(struct obd_export *exp, struct inode *inode, if (it->it_remote_lock_mode) { handle.cookie = it->it_remote_lock_handle; CDEBUG(D_DLMTRACE, "setting l_data to inode "DFID - "(%p) for remote lock "LPX64"\n", + "(%p) for remote lock %#llx\n", PFID(ll_inode2fid(inode)), inode, handle.cookie); - md_set_lock_data(exp, &handle.cookie, inode, NULL); + md_set_lock_data(exp, &handle, inode, NULL); } handle.cookie = it->it_lock_handle; CDEBUG(D_DLMTRACE, "setting l_data to inode "DFID"(%p)" - " for lock "LPX64"\n", + " for lock %#llx\n", PFID(ll_inode2fid(inode)), inode, handle.cookie); - md_set_lock_data(exp, &handle.cookie, inode, - &it->it_lock_bits); + md_set_lock_data(exp, &handle, inode, &it->it_lock_bits); it->it_lock_set = 1; } @@ -1444,13 +1441,6 @@ void cl_inode_fini(struct inode *inode); u64 cl_fid_build_ino(const struct lu_fid *fid, int api32); u32 cl_fid_build_gen(const struct lu_fid *fid); -#ifndef HAVE_FILE_INODE -static inline struct inode *file_inode(struct file *file) -{ - return file->f_path.dentry->d_inode; -} -#endif - #ifndef HAVE_IOV_ITER_TRUNCATE static inline void iov_iter_truncate(struct iov_iter *i, u64 count) { @@ -1459,6 +1449,17 @@ static inline void iov_iter_truncate(struct iov_iter *i, u64 count) } #endif +#ifndef HAVE_IS_SXID +static inline bool is_sxid(umode_t mode) +{ + return (mode & S_ISUID) || ((mode & S_ISGID) && (mode & S_IXGRP)); +} +#endif + +#ifndef IS_NOSEC +#define IS_NOSEC(inode) (!is_sxid(inode->i_mode)) +#endif + #ifndef HAVE_FILE_OPERATIONS_READ_WRITE_ITER static inline void iov_iter_reexpand(struct iov_iter *i, size_t count) { @@ -1507,7 +1508,7 @@ generic_file_read_iter(struct kiocb *iocb, struct iov_iter *iter) } static inline ssize_t -generic_file_write_iter(struct kiocb *iocb, struct iov_iter *iter) +__generic_file_write_iter(struct kiocb *iocb, struct iov_iter *iter) { struct iovec iov; struct iov_iter i;