diff options
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/aio.c | 20 | ||||
| -rw-r--r-- | fs/binfmt_elf.c | 1 | ||||
| -rw-r--r-- | fs/binfmt_flat.c | 2 | ||||
| -rw-r--r-- | fs/coda/Makefile | 3 | ||||
| -rw-r--r-- | fs/coda/cache.c | 2 | ||||
| -rw-r--r-- | fs/coda/cnode.c | 17 | ||||
| -rw-r--r-- | fs/coda/coda_fs_i.h | 4 | ||||
| -rw-r--r-- | fs/coda/coda_int.h | 10 | ||||
| -rw-r--r-- | fs/coda/coda_linux.c | 45 | ||||
| -rw-r--r-- | fs/coda/coda_linux.h | 16 | ||||
| -rw-r--r-- | fs/coda/coda_psdev.h | 95 | ||||
| -rw-r--r-- | fs/coda/dir.c | 12 | ||||
| -rw-r--r-- | fs/coda/file.c | 143 | ||||
| -rw-r--r-- | fs/coda/inode.c | 3 | ||||
| -rw-r--r-- | fs/coda/pioctl.c | 3 | ||||
| -rw-r--r-- | fs/coda/psdev.c | 36 | ||||
| -rw-r--r-- | fs/coda/symlink.c | 3 | ||||
| -rw-r--r-- | fs/coda/sysctl.c | 11 | ||||
| -rw-r--r-- | fs/coda/upcall.c | 146 | ||||
| -rw-r--r-- | fs/eventpoll.c | 12 | ||||
| -rw-r--r-- | fs/hfsplus/xattr.c | 2 | ||||
| -rw-r--r-- | fs/io_uring.c | 11 | ||||
| -rw-r--r-- | fs/proc/Kconfig | 3 | ||||
| -rw-r--r-- | fs/proc/inode.c | 27 | ||||
| -rw-r--r-- | fs/proc/proc_sysctl.c | 4 | ||||
| -rw-r--r-- | fs/proc/vmcore.c | 9 | ||||
| -rw-r--r-- | fs/reiserfs/journal.c | 6 | ||||
| -rw-r--r-- | fs/select.c | 96 | ||||
| -rw-r--r-- | fs/ufs/super.c | 2 |
29 files changed, 491 insertions, 253 deletions
| @@ -2094,7 +2094,6 @@ SYSCALL_DEFINE6(io_pgetevents, | |||
| 2094 | const struct __aio_sigset __user *, usig) | 2094 | const struct __aio_sigset __user *, usig) |
| 2095 | { | 2095 | { |
| 2096 | struct __aio_sigset ksig = { NULL, }; | 2096 | struct __aio_sigset ksig = { NULL, }; |
| 2097 | sigset_t ksigmask, sigsaved; | ||
| 2098 | struct timespec64 ts; | 2097 | struct timespec64 ts; |
| 2099 | bool interrupted; | 2098 | bool interrupted; |
| 2100 | int ret; | 2099 | int ret; |
| @@ -2105,14 +2104,14 @@ SYSCALL_DEFINE6(io_pgetevents, | |||
| 2105 | if (usig && copy_from_user(&ksig, usig, sizeof(ksig))) | 2104 | if (usig && copy_from_user(&ksig, usig, sizeof(ksig))) |
| 2106 | return -EFAULT; | 2105 | return -EFAULT; |
| 2107 | 2106 | ||
| 2108 | ret = set_user_sigmask(ksig.sigmask, &ksigmask, &sigsaved, ksig.sigsetsize); | 2107 | ret = set_user_sigmask(ksig.sigmask, ksig.sigsetsize); |
| 2109 | if (ret) | 2108 | if (ret) |
| 2110 | return ret; | 2109 | return ret; |
| 2111 | 2110 | ||
| 2112 | ret = do_io_getevents(ctx_id, min_nr, nr, events, timeout ? &ts : NULL); | 2111 | ret = do_io_getevents(ctx_id, min_nr, nr, events, timeout ? &ts : NULL); |
| 2113 | 2112 | ||
| 2114 | interrupted = signal_pending(current); | 2113 | interrupted = signal_pending(current); |
| 2115 | restore_user_sigmask(ksig.sigmask, &sigsaved, interrupted); | 2114 | restore_saved_sigmask_unless(interrupted); |
| 2116 | if (interrupted && !ret) | 2115 | if (interrupted && !ret) |
| 2117 | ret = -ERESTARTNOHAND; | 2116 | ret = -ERESTARTNOHAND; |
| 2118 | 2117 | ||
| @@ -2130,7 +2129,6 @@ SYSCALL_DEFINE6(io_pgetevents_time32, | |||
| 2130 | const struct __aio_sigset __user *, usig) | 2129 | const struct __aio_sigset __user *, usig) |
| 2131 | { | 2130 | { |
| 2132 | struct __aio_sigset ksig = { NULL, }; | 2131 | struct __aio_sigset ksig = { NULL, }; |
| 2133 | sigset_t ksigmask, sigsaved; | ||
| 2134 | struct timespec64 ts; | 2132 | struct timespec64 ts; |
| 2135 | bool interrupted; | 2133 | bool interrupted; |
| 2136 | int ret; | 2134 | int ret; |
| @@ -2142,14 +2140,14 @@ SYSCALL_DEFINE6(io_pgetevents_time32, | |||
| 2142 | return -EFAULT; | 2140 | return -EFAULT; |
| 2143 | 2141 | ||
| 2144 | 2142 | ||
| 2145 | ret = set_user_sigmask(ksig.sigmask, &ksigmask, &sigsaved, ksig.sigsetsize); | 2143 | ret = set_user_sigmask(ksig.sigmask, ksig.sigsetsize); |
| 2146 | if (ret) | 2144 | if (ret) |
| 2147 | return ret; | 2145 | return ret; |
| 2148 | 2146 | ||
| 2149 | ret = do_io_getevents(ctx_id, min_nr, nr, events, timeout ? &ts : NULL); | 2147 | ret = do_io_getevents(ctx_id, min_nr, nr, events, timeout ? &ts : NULL); |
| 2150 | 2148 | ||
| 2151 | interrupted = signal_pending(current); | 2149 | interrupted = signal_pending(current); |
| 2152 | restore_user_sigmask(ksig.sigmask, &sigsaved, interrupted); | 2150 | restore_saved_sigmask_unless(interrupted); |
| 2153 | if (interrupted && !ret) | 2151 | if (interrupted && !ret) |
| 2154 | ret = -ERESTARTNOHAND; | 2152 | ret = -ERESTARTNOHAND; |
| 2155 | 2153 | ||
| @@ -2198,7 +2196,6 @@ COMPAT_SYSCALL_DEFINE6(io_pgetevents, | |||
| 2198 | const struct __compat_aio_sigset __user *, usig) | 2196 | const struct __compat_aio_sigset __user *, usig) |
| 2199 | { | 2197 | { |
| 2200 | struct __compat_aio_sigset ksig = { NULL, }; | 2198 | struct __compat_aio_sigset ksig = { NULL, }; |
| 2201 | sigset_t ksigmask, sigsaved; | ||
| 2202 | struct timespec64 t; | 2199 | struct timespec64 t; |
| 2203 | bool interrupted; | 2200 | bool interrupted; |
| 2204 | int ret; | 2201 | int ret; |
| @@ -2209,14 +2206,14 @@ COMPAT_SYSCALL_DEFINE6(io_pgetevents, | |||
| 2209 | if (usig && copy_from_user(&ksig, usig, sizeof(ksig))) | 2206 | if (usig && copy_from_user(&ksig, usig, sizeof(ksig))) |
| 2210 | return -EFAULT; | 2207 | return -EFAULT; |
| 2211 | 2208 | ||
| 2212 | ret = set_compat_user_sigmask(ksig.sigmask, &ksigmask, &sigsaved, ksig.sigsetsize); | 2209 | ret = set_compat_user_sigmask(ksig.sigmask, ksig.sigsetsize); |
| 2213 | if (ret) | 2210 | if (ret) |
| 2214 | return ret; | 2211 | return ret; |
| 2215 | 2212 | ||
| 2216 | ret = do_io_getevents(ctx_id, min_nr, nr, events, timeout ? &t : NULL); | 2213 | ret = do_io_getevents(ctx_id, min_nr, nr, events, timeout ? &t : NULL); |
| 2217 | 2214 | ||
| 2218 | interrupted = signal_pending(current); | 2215 | interrupted = signal_pending(current); |
| 2219 | restore_user_sigmask(ksig.sigmask, &sigsaved, interrupted); | 2216 | restore_saved_sigmask_unless(interrupted); |
| 2220 | if (interrupted && !ret) | 2217 | if (interrupted && !ret) |
| 2221 | ret = -ERESTARTNOHAND; | 2218 | ret = -ERESTARTNOHAND; |
| 2222 | 2219 | ||
| @@ -2234,7 +2231,6 @@ COMPAT_SYSCALL_DEFINE6(io_pgetevents_time64, | |||
| 2234 | const struct __compat_aio_sigset __user *, usig) | 2231 | const struct __compat_aio_sigset __user *, usig) |
| 2235 | { | 2232 | { |
| 2236 | struct __compat_aio_sigset ksig = { NULL, }; | 2233 | struct __compat_aio_sigset ksig = { NULL, }; |
| 2237 | sigset_t ksigmask, sigsaved; | ||
| 2238 | struct timespec64 t; | 2234 | struct timespec64 t; |
| 2239 | bool interrupted; | 2235 | bool interrupted; |
| 2240 | int ret; | 2236 | int ret; |
| @@ -2245,14 +2241,14 @@ COMPAT_SYSCALL_DEFINE6(io_pgetevents_time64, | |||
| 2245 | if (usig && copy_from_user(&ksig, usig, sizeof(ksig))) | 2241 | if (usig && copy_from_user(&ksig, usig, sizeof(ksig))) |
| 2246 | return -EFAULT; | 2242 | return -EFAULT; |
| 2247 | 2243 | ||
| 2248 | ret = set_compat_user_sigmask(ksig.sigmask, &ksigmask, &sigsaved, ksig.sigsetsize); | 2244 | ret = set_compat_user_sigmask(ksig.sigmask, ksig.sigsetsize); |
| 2249 | if (ret) | 2245 | if (ret) |
| 2250 | return ret; | 2246 | return ret; |
| 2251 | 2247 | ||
| 2252 | ret = do_io_getevents(ctx_id, min_nr, nr, events, timeout ? &t : NULL); | 2248 | ret = do_io_getevents(ctx_id, min_nr, nr, events, timeout ? &t : NULL); |
| 2253 | 2249 | ||
| 2254 | interrupted = signal_pending(current); | 2250 | interrupted = signal_pending(current); |
| 2255 | restore_user_sigmask(ksig.sigmask, &sigsaved, interrupted); | 2251 | restore_saved_sigmask_unless(interrupted); |
| 2256 | if (interrupted && !ret) | 2252 | if (interrupted && !ret) |
| 2257 | ret = -ERESTARTNOHAND; | 2253 | ret = -ERESTARTNOHAND; |
| 2258 | 2254 | ||
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 8264b468f283..d4e11b2e04f6 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
| @@ -1127,7 +1127,6 @@ out_free_interp: | |||
| 1127 | load_addr, interp_load_addr); | 1127 | load_addr, interp_load_addr); |
| 1128 | if (retval < 0) | 1128 | if (retval < 0) |
| 1129 | goto out; | 1129 | goto out; |
| 1130 | /* N.B. passed_fileno might not be initialized? */ | ||
| 1131 | current->mm->end_code = end_code; | 1130 | current->mm->end_code = end_code; |
| 1132 | current->mm->start_code = start_code; | 1131 | current->mm->start_code = start_code; |
| 1133 | current->mm->start_data = start_data; | 1132 | current->mm->start_data = start_data; |
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c index 8c6b50f34466..831a2b25ba79 100644 --- a/fs/binfmt_flat.c +++ b/fs/binfmt_flat.c | |||
| @@ -431,7 +431,6 @@ static int load_flat_file(struct linux_binprm *bprm, | |||
| 431 | unsigned long len, memp, memp_size, extra, rlim; | 431 | unsigned long len, memp, memp_size, extra, rlim; |
| 432 | __be32 __user *reloc; | 432 | __be32 __user *reloc; |
| 433 | u32 __user *rp; | 433 | u32 __user *rp; |
| 434 | struct inode *inode; | ||
| 435 | int i, rev, relocs; | 434 | int i, rev, relocs; |
| 436 | loff_t fpos; | 435 | loff_t fpos; |
| 437 | unsigned long start_code, end_code; | 436 | unsigned long start_code, end_code; |
| @@ -439,7 +438,6 @@ static int load_flat_file(struct linux_binprm *bprm, | |||
| 439 | int ret; | 438 | int ret; |
| 440 | 439 | ||
| 441 | hdr = ((struct flat_hdr *) bprm->buf); /* exec-header */ | 440 | hdr = ((struct flat_hdr *) bprm->buf); /* exec-header */ |
| 442 | inode = file_inode(bprm->file); | ||
| 443 | 441 | ||
| 444 | text_len = ntohl(hdr->data_start); | 442 | text_len = ntohl(hdr->data_start); |
| 445 | data_len = ntohl(hdr->data_end) - ntohl(hdr->data_start); | 443 | data_len = ntohl(hdr->data_end) - ntohl(hdr->data_start); |
diff --git a/fs/coda/Makefile b/fs/coda/Makefile index 1ce66819da2a..78befb8369c9 100644 --- a/fs/coda/Makefile +++ b/fs/coda/Makefile | |||
| @@ -6,7 +6,8 @@ | |||
| 6 | obj-$(CONFIG_CODA_FS) += coda.o | 6 | obj-$(CONFIG_CODA_FS) += coda.o |
| 7 | 7 | ||
| 8 | coda-objs := psdev.o cache.o cnode.o inode.o dir.o file.o upcall.o \ | 8 | coda-objs := psdev.o cache.o cnode.o inode.o dir.o file.o upcall.o \ |
| 9 | coda_linux.o symlink.o pioctl.o sysctl.o | 9 | coda_linux.o symlink.o pioctl.o |
| 10 | coda-$(CONFIG_SYSCTL) += sysctl.o | ||
| 10 | 11 | ||
| 11 | # If you want debugging output, please uncomment the following line. | 12 | # If you want debugging output, please uncomment the following line. |
| 12 | 13 | ||
diff --git a/fs/coda/cache.c b/fs/coda/cache.c index 201fc08a8b4f..3b8c4513118f 100644 --- a/fs/coda/cache.c +++ b/fs/coda/cache.c | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | #include <linux/spinlock.h> | 21 | #include <linux/spinlock.h> |
| 22 | 22 | ||
| 23 | #include <linux/coda.h> | 23 | #include <linux/coda.h> |
| 24 | #include <linux/coda_psdev.h> | 24 | #include "coda_psdev.h" |
| 25 | #include "coda_linux.h" | 25 | #include "coda_linux.h" |
| 26 | #include "coda_cache.h" | 26 | #include "coda_cache.h" |
| 27 | 27 | ||
diff --git a/fs/coda/cnode.c b/fs/coda/cnode.c index 845b5a66952a..06855f6c7902 100644 --- a/fs/coda/cnode.c +++ b/fs/coda/cnode.c | |||
| @@ -8,8 +8,8 @@ | |||
| 8 | #include <linux/time.h> | 8 | #include <linux/time.h> |
| 9 | 9 | ||
| 10 | #include <linux/coda.h> | 10 | #include <linux/coda.h> |
| 11 | #include <linux/coda_psdev.h> | ||
| 12 | #include <linux/pagemap.h> | 11 | #include <linux/pagemap.h> |
| 12 | #include "coda_psdev.h" | ||
| 13 | #include "coda_linux.h" | 13 | #include "coda_linux.h" |
| 14 | 14 | ||
| 15 | static inline int coda_fideq(struct CodaFid *fid1, struct CodaFid *fid2) | 15 | static inline int coda_fideq(struct CodaFid *fid1, struct CodaFid *fid2) |
| @@ -137,11 +137,6 @@ struct inode *coda_fid_to_inode(struct CodaFid *fid, struct super_block *sb) | |||
| 137 | struct inode *inode; | 137 | struct inode *inode; |
| 138 | unsigned long hash = coda_f2i(fid); | 138 | unsigned long hash = coda_f2i(fid); |
| 139 | 139 | ||
| 140 | if ( !sb ) { | ||
| 141 | pr_warn("%s: no sb!\n", __func__); | ||
| 142 | return NULL; | ||
| 143 | } | ||
| 144 | |||
| 145 | inode = ilookup5(sb, hash, coda_test_inode, fid); | 140 | inode = ilookup5(sb, hash, coda_test_inode, fid); |
| 146 | if ( !inode ) | 141 | if ( !inode ) |
| 147 | return NULL; | 142 | return NULL; |
| @@ -153,6 +148,16 @@ struct inode *coda_fid_to_inode(struct CodaFid *fid, struct super_block *sb) | |||
| 153 | return inode; | 148 | return inode; |
| 154 | } | 149 | } |
| 155 | 150 | ||
| 151 | struct coda_file_info *coda_ftoc(struct file *file) | ||
| 152 | { | ||
| 153 | struct coda_file_info *cfi = file->private_data; | ||
| 154 | |||
| 155 | BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC); | ||
| 156 | |||
| 157 | return cfi; | ||
| 158 | |||
| 159 | } | ||
| 160 | |||
| 156 | /* the CONTROL inode is made without asking attributes from Venus */ | 161 | /* the CONTROL inode is made without asking attributes from Venus */ |
| 157 | struct inode *coda_cnode_makectl(struct super_block *sb) | 162 | struct inode *coda_cnode_makectl(struct super_block *sb) |
| 158 | { | 163 | { |
diff --git a/fs/coda/coda_fs_i.h b/fs/coda/coda_fs_i.h index d702ba1a2bf9..1763ff95d865 100644 --- a/fs/coda/coda_fs_i.h +++ b/fs/coda/coda_fs_i.h | |||
| @@ -40,10 +40,9 @@ struct coda_file_info { | |||
| 40 | int cfi_magic; /* magic number */ | 40 | int cfi_magic; /* magic number */ |
| 41 | struct file *cfi_container; /* container file for this cnode */ | 41 | struct file *cfi_container; /* container file for this cnode */ |
| 42 | unsigned int cfi_mapcount; /* nr of times this file is mapped */ | 42 | unsigned int cfi_mapcount; /* nr of times this file is mapped */ |
| 43 | bool cfi_access_intent; /* is access intent supported */ | ||
| 43 | }; | 44 | }; |
| 44 | 45 | ||
| 45 | #define CODA_FTOC(file) ((struct coda_file_info *)((file)->private_data)) | ||
| 46 | |||
| 47 | /* flags */ | 46 | /* flags */ |
| 48 | #define C_VATTR 0x1 /* Validity of vattr in inode */ | 47 | #define C_VATTR 0x1 /* Validity of vattr in inode */ |
| 49 | #define C_FLUSH 0x2 /* used after a flush */ | 48 | #define C_FLUSH 0x2 /* used after a flush */ |
| @@ -54,6 +53,7 @@ struct inode *coda_cnode_make(struct CodaFid *, struct super_block *); | |||
| 54 | struct inode *coda_iget(struct super_block *sb, struct CodaFid *fid, struct coda_vattr *attr); | 53 | struct inode *coda_iget(struct super_block *sb, struct CodaFid *fid, struct coda_vattr *attr); |
| 55 | struct inode *coda_cnode_makectl(struct super_block *sb); | 54 | struct inode *coda_cnode_makectl(struct super_block *sb); |
| 56 | struct inode *coda_fid_to_inode(struct CodaFid *fid, struct super_block *sb); | 55 | struct inode *coda_fid_to_inode(struct CodaFid *fid, struct super_block *sb); |
| 56 | struct coda_file_info *coda_ftoc(struct file *file); | ||
| 57 | void coda_replace_fid(struct inode *, struct CodaFid *, struct CodaFid *); | 57 | void coda_replace_fid(struct inode *, struct CodaFid *, struct CodaFid *); |
| 58 | 58 | ||
| 59 | #endif | 59 | #endif |
diff --git a/fs/coda/coda_int.h b/fs/coda/coda_int.h index bb0b3e0ed6c2..f82b59c9dd28 100644 --- a/fs/coda/coda_int.h +++ b/fs/coda/coda_int.h | |||
| @@ -13,9 +13,19 @@ extern int coda_fake_statfs; | |||
| 13 | void coda_destroy_inodecache(void); | 13 | void coda_destroy_inodecache(void); |
| 14 | int __init coda_init_inodecache(void); | 14 | int __init coda_init_inodecache(void); |
| 15 | int coda_fsync(struct file *coda_file, loff_t start, loff_t end, int datasync); | 15 | int coda_fsync(struct file *coda_file, loff_t start, loff_t end, int datasync); |
| 16 | |||
| 17 | #ifdef CONFIG_SYSCTL | ||
| 16 | void coda_sysctl_init(void); | 18 | void coda_sysctl_init(void); |
| 17 | void coda_sysctl_clean(void); | 19 | void coda_sysctl_clean(void); |
| 20 | #else | ||
| 21 | static inline void coda_sysctl_init(void) | ||
| 22 | { | ||
| 23 | } | ||
| 18 | 24 | ||
| 25 | static inline void coda_sysctl_clean(void) | ||
| 26 | { | ||
| 27 | } | ||
| 28 | #endif | ||
| 19 | #endif /* _CODA_INT_ */ | 29 | #endif /* _CODA_INT_ */ |
| 20 | 30 | ||
| 21 | 31 | ||
diff --git a/fs/coda/coda_linux.c b/fs/coda/coda_linux.c index f3d543dd9a98..2e1a5a192074 100644 --- a/fs/coda/coda_linux.c +++ b/fs/coda/coda_linux.c | |||
| @@ -18,7 +18,7 @@ | |||
| 18 | #include <linux/string.h> | 18 | #include <linux/string.h> |
| 19 | 19 | ||
| 20 | #include <linux/coda.h> | 20 | #include <linux/coda.h> |
| 21 | #include <linux/coda_psdev.h> | 21 | #include "coda_psdev.h" |
| 22 | #include "coda_linux.h" | 22 | #include "coda_linux.h" |
| 23 | 23 | ||
| 24 | /* initialize the debugging variables */ | 24 | /* initialize the debugging variables */ |
| @@ -66,6 +66,25 @@ unsigned short coda_flags_to_cflags(unsigned short flags) | |||
| 66 | return coda_flags; | 66 | return coda_flags; |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | static struct timespec64 coda_to_timespec64(struct coda_timespec ts) | ||
| 70 | { | ||
| 71 | struct timespec64 ts64 = { | ||
| 72 | .tv_sec = ts.tv_sec, | ||
| 73 | .tv_nsec = ts.tv_nsec, | ||
| 74 | }; | ||
| 75 | |||
| 76 | return ts64; | ||
| 77 | } | ||
| 78 | |||
| 79 | static struct coda_timespec timespec64_to_coda(struct timespec64 ts64) | ||
| 80 | { | ||
| 81 | struct coda_timespec ts = { | ||
| 82 | .tv_sec = ts64.tv_sec, | ||
| 83 | .tv_nsec = ts64.tv_nsec, | ||
| 84 | }; | ||
| 85 | |||
| 86 | return ts; | ||
| 87 | } | ||
| 69 | 88 | ||
| 70 | /* utility functions below */ | 89 | /* utility functions below */ |
| 71 | void coda_vattr_to_iattr(struct inode *inode, struct coda_vattr *attr) | 90 | void coda_vattr_to_iattr(struct inode *inode, struct coda_vattr *attr) |
| @@ -105,11 +124,11 @@ void coda_vattr_to_iattr(struct inode *inode, struct coda_vattr *attr) | |||
| 105 | if (attr->va_size != -1) | 124 | if (attr->va_size != -1) |
| 106 | inode->i_blocks = (attr->va_size + 511) >> 9; | 125 | inode->i_blocks = (attr->va_size + 511) >> 9; |
| 107 | if (attr->va_atime.tv_sec != -1) | 126 | if (attr->va_atime.tv_sec != -1) |
| 108 | inode->i_atime = timespec_to_timespec64(attr->va_atime); | 127 | inode->i_atime = coda_to_timespec64(attr->va_atime); |
| 109 | if (attr->va_mtime.tv_sec != -1) | 128 | if (attr->va_mtime.tv_sec != -1) |
| 110 | inode->i_mtime = timespec_to_timespec64(attr->va_mtime); | 129 | inode->i_mtime = coda_to_timespec64(attr->va_mtime); |
| 111 | if (attr->va_ctime.tv_sec != -1) | 130 | if (attr->va_ctime.tv_sec != -1) |
| 112 | inode->i_ctime = timespec_to_timespec64(attr->va_ctime); | 131 | inode->i_ctime = coda_to_timespec64(attr->va_ctime); |
| 113 | } | 132 | } |
| 114 | 133 | ||
| 115 | 134 | ||
| @@ -130,12 +149,12 @@ void coda_iattr_to_vattr(struct iattr *iattr, struct coda_vattr *vattr) | |||
| 130 | vattr->va_uid = (vuid_t) -1; | 149 | vattr->va_uid = (vuid_t) -1; |
| 131 | vattr->va_gid = (vgid_t) -1; | 150 | vattr->va_gid = (vgid_t) -1; |
| 132 | vattr->va_size = (off_t) -1; | 151 | vattr->va_size = (off_t) -1; |
| 133 | vattr->va_atime.tv_sec = (time_t) -1; | 152 | vattr->va_atime.tv_sec = (int64_t) -1; |
| 134 | vattr->va_atime.tv_nsec = (time_t) -1; | 153 | vattr->va_atime.tv_nsec = (long) -1; |
| 135 | vattr->va_mtime.tv_sec = (time_t) -1; | 154 | vattr->va_mtime.tv_sec = (int64_t) -1; |
| 136 | vattr->va_mtime.tv_nsec = (time_t) -1; | 155 | vattr->va_mtime.tv_nsec = (long) -1; |
| 137 | vattr->va_ctime.tv_sec = (time_t) -1; | 156 | vattr->va_ctime.tv_sec = (int64_t) -1; |
| 138 | vattr->va_ctime.tv_nsec = (time_t) -1; | 157 | vattr->va_ctime.tv_nsec = (long) -1; |
| 139 | vattr->va_type = C_VNON; | 158 | vattr->va_type = C_VNON; |
| 140 | vattr->va_fileid = -1; | 159 | vattr->va_fileid = -1; |
| 141 | vattr->va_gen = -1; | 160 | vattr->va_gen = -1; |
| @@ -175,13 +194,13 @@ void coda_iattr_to_vattr(struct iattr *iattr, struct coda_vattr *vattr) | |||
| 175 | vattr->va_size = iattr->ia_size; | 194 | vattr->va_size = iattr->ia_size; |
| 176 | } | 195 | } |
| 177 | if ( valid & ATTR_ATIME ) { | 196 | if ( valid & ATTR_ATIME ) { |
| 178 | vattr->va_atime = timespec64_to_timespec(iattr->ia_atime); | 197 | vattr->va_atime = timespec64_to_coda(iattr->ia_atime); |
| 179 | } | 198 | } |
| 180 | if ( valid & ATTR_MTIME ) { | 199 | if ( valid & ATTR_MTIME ) { |
| 181 | vattr->va_mtime = timespec64_to_timespec(iattr->ia_mtime); | 200 | vattr->va_mtime = timespec64_to_coda(iattr->ia_mtime); |
| 182 | } | 201 | } |
| 183 | if ( valid & ATTR_CTIME ) { | 202 | if ( valid & ATTR_CTIME ) { |
| 184 | vattr->va_ctime = timespec64_to_timespec(iattr->ia_ctime); | 203 | vattr->va_ctime = timespec64_to_coda(iattr->ia_ctime); |
| 185 | } | 204 | } |
| 186 | } | 205 | } |
| 187 | 206 | ||
diff --git a/fs/coda/coda_linux.h b/fs/coda/coda_linux.h index 126155cadfa9..d5ebd36fb2cc 100644 --- a/fs/coda/coda_linux.h +++ b/fs/coda/coda_linux.h | |||
| @@ -59,22 +59,6 @@ void coda_vattr_to_iattr(struct inode *, struct coda_vattr *); | |||
| 59 | void coda_iattr_to_vattr(struct iattr *, struct coda_vattr *); | 59 | void coda_iattr_to_vattr(struct iattr *, struct coda_vattr *); |
| 60 | unsigned short coda_flags_to_cflags(unsigned short); | 60 | unsigned short coda_flags_to_cflags(unsigned short); |
| 61 | 61 | ||
| 62 | /* sysctl.h */ | ||
| 63 | void coda_sysctl_init(void); | ||
| 64 | void coda_sysctl_clean(void); | ||
| 65 | |||
| 66 | #define CODA_ALLOC(ptr, cast, size) do { \ | ||
| 67 | if (size < PAGE_SIZE) \ | ||
| 68 | ptr = kzalloc((unsigned long) size, GFP_KERNEL); \ | ||
| 69 | else \ | ||
| 70 | ptr = (cast)vzalloc((unsigned long) size); \ | ||
| 71 | if (!ptr) \ | ||
| 72 | pr_warn("kernel malloc returns 0 at %s:%d\n", __FILE__, __LINE__); \ | ||
| 73 | } while (0) | ||
| 74 | |||
| 75 | |||
| 76 | #define CODA_FREE(ptr, size) kvfree((ptr)) | ||
| 77 | |||
| 78 | /* inode to cnode access functions */ | 62 | /* inode to cnode access functions */ |
| 79 | 63 | ||
| 80 | static inline struct coda_inode_info *ITOC(struct inode *inode) | 64 | static inline struct coda_inode_info *ITOC(struct inode *inode) |
diff --git a/fs/coda/coda_psdev.h b/fs/coda/coda_psdev.h new file mode 100644 index 000000000000..52da08c770b0 --- /dev/null +++ b/fs/coda/coda_psdev.h | |||
| @@ -0,0 +1,95 @@ | |||
| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | ||
| 2 | #ifndef __CODA_PSDEV_H | ||
| 3 | #define __CODA_PSDEV_H | ||
| 4 | |||
| 5 | #include <linux/backing-dev.h> | ||
| 6 | #include <linux/magic.h> | ||
| 7 | #include <linux/mutex.h> | ||
| 8 | |||
| 9 | #define CODA_PSDEV_MAJOR 67 | ||
| 10 | #define MAX_CODADEVS 5 /* how many do we allow */ | ||
| 11 | |||
| 12 | struct kstatfs; | ||
| 13 | |||
| 14 | /* messages between coda filesystem in kernel and Venus */ | ||
| 15 | struct upc_req { | ||
| 16 | struct list_head uc_chain; | ||
| 17 | caddr_t uc_data; | ||
| 18 | u_short uc_flags; | ||
| 19 | u_short uc_inSize; /* Size is at most 5000 bytes */ | ||
| 20 | u_short uc_outSize; | ||
| 21 | u_short uc_opcode; /* copied from data to save lookup */ | ||
| 22 | int uc_unique; | ||
| 23 | wait_queue_head_t uc_sleep; /* process' wait queue */ | ||
| 24 | }; | ||
| 25 | |||
| 26 | #define CODA_REQ_ASYNC 0x1 | ||
| 27 | #define CODA_REQ_READ 0x2 | ||
| 28 | #define CODA_REQ_WRITE 0x4 | ||
| 29 | #define CODA_REQ_ABORT 0x8 | ||
| 30 | |||
| 31 | /* communication pending/processing queues */ | ||
| 32 | struct venus_comm { | ||
| 33 | u_long vc_seq; | ||
| 34 | wait_queue_head_t vc_waitq; /* Venus wait queue */ | ||
| 35 | struct list_head vc_pending; | ||
| 36 | struct list_head vc_processing; | ||
| 37 | int vc_inuse; | ||
| 38 | struct super_block *vc_sb; | ||
| 39 | struct mutex vc_mutex; | ||
| 40 | }; | ||
| 41 | |||
| 42 | static inline struct venus_comm *coda_vcp(struct super_block *sb) | ||
| 43 | { | ||
| 44 | return (struct venus_comm *)((sb)->s_fs_info); | ||
| 45 | } | ||
| 46 | |||
| 47 | /* upcalls */ | ||
| 48 | int venus_rootfid(struct super_block *sb, struct CodaFid *fidp); | ||
| 49 | int venus_getattr(struct super_block *sb, struct CodaFid *fid, | ||
| 50 | struct coda_vattr *attr); | ||
| 51 | int venus_setattr(struct super_block *, struct CodaFid *, struct coda_vattr *); | ||
| 52 | int venus_lookup(struct super_block *sb, struct CodaFid *fid, | ||
| 53 | const char *name, int length, int *type, | ||
| 54 | struct CodaFid *resfid); | ||
| 55 | int venus_close(struct super_block *sb, struct CodaFid *fid, int flags, | ||
| 56 | kuid_t uid); | ||
| 57 | int venus_open(struct super_block *sb, struct CodaFid *fid, int flags, | ||
| 58 | struct file **f); | ||
| 59 | int venus_mkdir(struct super_block *sb, struct CodaFid *dirfid, | ||
| 60 | const char *name, int length, | ||
| 61 | struct CodaFid *newfid, struct coda_vattr *attrs); | ||
| 62 | int venus_create(struct super_block *sb, struct CodaFid *dirfid, | ||
| 63 | const char *name, int length, int excl, int mode, | ||
| 64 | struct CodaFid *newfid, struct coda_vattr *attrs); | ||
| 65 | int venus_rmdir(struct super_block *sb, struct CodaFid *dirfid, | ||
| 66 | const char *name, int length); | ||
| 67 | int venus_remove(struct super_block *sb, struct CodaFid *dirfid, | ||
| 68 | const char *name, int length); | ||
| 69 | int venus_readlink(struct super_block *sb, struct CodaFid *fid, | ||
| 70 | char *buffer, int *length); | ||
| 71 | int venus_rename(struct super_block *sb, struct CodaFid *new_fid, | ||
| 72 | struct CodaFid *old_fid, size_t old_length, | ||
| 73 | size_t new_length, const char *old_name, | ||
| 74 | const char *new_name); | ||
| 75 | int venus_link(struct super_block *sb, struct CodaFid *fid, | ||
| 76 | struct CodaFid *dirfid, const char *name, int len ); | ||
| 77 | int venus_symlink(struct super_block *sb, struct CodaFid *fid, | ||
| 78 | const char *name, int len, const char *symname, int symlen); | ||
| 79 | int venus_access(struct super_block *sb, struct CodaFid *fid, int mask); | ||
| 80 | int venus_pioctl(struct super_block *sb, struct CodaFid *fid, | ||
| 81 | unsigned int cmd, struct PioctlData *data); | ||
| 82 | int coda_downcall(struct venus_comm *vcp, int opcode, union outputArgs *out, | ||
| 83 | size_t nbytes); | ||
| 84 | int venus_fsync(struct super_block *sb, struct CodaFid *fid); | ||
| 85 | int venus_statfs(struct dentry *dentry, struct kstatfs *sfs); | ||
| 86 | int venus_access_intent(struct super_block *sb, struct CodaFid *fid, | ||
| 87 | bool *access_intent_supported, | ||
| 88 | size_t count, loff_t ppos, int type); | ||
| 89 | |||
| 90 | /* | ||
| 91 | * Statistics | ||
| 92 | */ | ||
| 93 | |||
| 94 | extern struct venus_comm coda_comms[]; | ||
| 95 | #endif | ||
diff --git a/fs/coda/dir.c b/fs/coda/dir.c index 00876ddadb43..ca40c2556ba6 100644 --- a/fs/coda/dir.c +++ b/fs/coda/dir.c | |||
| @@ -23,7 +23,7 @@ | |||
| 23 | #include <linux/uaccess.h> | 23 | #include <linux/uaccess.h> |
| 24 | 24 | ||
| 25 | #include <linux/coda.h> | 25 | #include <linux/coda.h> |
| 26 | #include <linux/coda_psdev.h> | 26 | #include "coda_psdev.h" |
| 27 | #include "coda_linux.h" | 27 | #include "coda_linux.h" |
| 28 | #include "coda_cache.h" | 28 | #include "coda_cache.h" |
| 29 | 29 | ||
| @@ -47,8 +47,8 @@ static struct dentry *coda_lookup(struct inode *dir, struct dentry *entry, unsig | |||
| 47 | int type = 0; | 47 | int type = 0; |
| 48 | 48 | ||
| 49 | if (length > CODA_MAXNAMLEN) { | 49 | if (length > CODA_MAXNAMLEN) { |
| 50 | pr_err("name too long: lookup, %s (%*s)\n", | 50 | pr_err("name too long: lookup, %s %zu\n", |
| 51 | coda_i2s(dir), (int)length, name); | 51 | coda_i2s(dir), length); |
| 52 | return ERR_PTR(-ENAMETOOLONG); | 52 | return ERR_PTR(-ENAMETOOLONG); |
| 53 | } | 53 | } |
| 54 | 54 | ||
| @@ -356,8 +356,7 @@ static int coda_venus_readdir(struct file *coda_file, struct dir_context *ctx) | |||
| 356 | ino_t ino; | 356 | ino_t ino; |
| 357 | int ret; | 357 | int ret; |
| 358 | 358 | ||
| 359 | cfi = CODA_FTOC(coda_file); | 359 | cfi = coda_ftoc(coda_file); |
| 360 | BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC); | ||
| 361 | host_file = cfi->cfi_container; | 360 | host_file = cfi->cfi_container; |
| 362 | 361 | ||
| 363 | cii = ITOC(file_inode(coda_file)); | 362 | cii = ITOC(file_inode(coda_file)); |
| @@ -426,8 +425,7 @@ static int coda_readdir(struct file *coda_file, struct dir_context *ctx) | |||
| 426 | struct file *host_file; | 425 | struct file *host_file; |
| 427 | int ret; | 426 | int ret; |
| 428 | 427 | ||
| 429 | cfi = CODA_FTOC(coda_file); | 428 | cfi = coda_ftoc(coda_file); |
| 430 | BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC); | ||
| 431 | host_file = cfi->cfi_container; | 429 | host_file = cfi->cfi_container; |
| 432 | 430 | ||
| 433 | if (host_file->f_op->iterate || host_file->f_op->iterate_shared) { | 431 | if (host_file->f_op->iterate || host_file->f_op->iterate_shared) { |
diff --git a/fs/coda/file.c b/fs/coda/file.c index 1cbc1f2298ee..128d63df5bfb 100644 --- a/fs/coda/file.c +++ b/fs/coda/file.c | |||
| @@ -20,22 +20,43 @@ | |||
| 20 | #include <linux/string.h> | 20 | #include <linux/string.h> |
| 21 | #include <linux/slab.h> | 21 | #include <linux/slab.h> |
| 22 | #include <linux/uaccess.h> | 22 | #include <linux/uaccess.h> |
| 23 | #include <linux/uio.h> | ||
| 23 | 24 | ||
| 24 | #include <linux/coda.h> | 25 | #include <linux/coda.h> |
| 25 | #include <linux/coda_psdev.h> | 26 | #include "coda_psdev.h" |
| 26 | |||
| 27 | #include "coda_linux.h" | 27 | #include "coda_linux.h" |
| 28 | #include "coda_int.h" | 28 | #include "coda_int.h" |
| 29 | 29 | ||
| 30 | struct coda_vm_ops { | ||
| 31 | atomic_t refcnt; | ||
| 32 | struct file *coda_file; | ||
| 33 | const struct vm_operations_struct *host_vm_ops; | ||
| 34 | struct vm_operations_struct vm_ops; | ||
| 35 | }; | ||
| 36 | |||
| 30 | static ssize_t | 37 | static ssize_t |
| 31 | coda_file_read_iter(struct kiocb *iocb, struct iov_iter *to) | 38 | coda_file_read_iter(struct kiocb *iocb, struct iov_iter *to) |
| 32 | { | 39 | { |
| 33 | struct file *coda_file = iocb->ki_filp; | 40 | struct file *coda_file = iocb->ki_filp; |
| 34 | struct coda_file_info *cfi = CODA_FTOC(coda_file); | 41 | struct inode *coda_inode = file_inode(coda_file); |
| 42 | struct coda_file_info *cfi = coda_ftoc(coda_file); | ||
| 43 | loff_t ki_pos = iocb->ki_pos; | ||
| 44 | size_t count = iov_iter_count(to); | ||
| 45 | ssize_t ret; | ||
| 35 | 46 | ||
| 36 | BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC); | 47 | ret = venus_access_intent(coda_inode->i_sb, coda_i2f(coda_inode), |
| 48 | &cfi->cfi_access_intent, | ||
| 49 | count, ki_pos, CODA_ACCESS_TYPE_READ); | ||
| 50 | if (ret) | ||
| 51 | goto finish_read; | ||
| 37 | 52 | ||
| 38 | return vfs_iter_read(cfi->cfi_container, to, &iocb->ki_pos, 0); | 53 | ret = vfs_iter_read(cfi->cfi_container, to, &iocb->ki_pos, 0); |
| 54 | |||
| 55 | finish_read: | ||
| 56 | venus_access_intent(coda_inode->i_sb, coda_i2f(coda_inode), | ||
| 57 | &cfi->cfi_access_intent, | ||
| 58 | count, ki_pos, CODA_ACCESS_TYPE_READ_FINISH); | ||
| 59 | return ret; | ||
| 39 | } | 60 | } |
| 40 | 61 | ||
| 41 | static ssize_t | 62 | static ssize_t |
| @@ -43,13 +64,18 @@ coda_file_write_iter(struct kiocb *iocb, struct iov_iter *to) | |||
| 43 | { | 64 | { |
| 44 | struct file *coda_file = iocb->ki_filp; | 65 | struct file *coda_file = iocb->ki_filp; |
| 45 | struct inode *coda_inode = file_inode(coda_file); | 66 | struct inode *coda_inode = file_inode(coda_file); |
| 46 | struct coda_file_info *cfi = CODA_FTOC(coda_file); | 67 | struct coda_file_info *cfi = coda_ftoc(coda_file); |
| 47 | struct file *host_file; | 68 | struct file *host_file = cfi->cfi_container; |
| 69 | loff_t ki_pos = iocb->ki_pos; | ||
| 70 | size_t count = iov_iter_count(to); | ||
| 48 | ssize_t ret; | 71 | ssize_t ret; |
| 49 | 72 | ||
| 50 | BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC); | 73 | ret = venus_access_intent(coda_inode->i_sb, coda_i2f(coda_inode), |
| 74 | &cfi->cfi_access_intent, | ||
| 75 | count, ki_pos, CODA_ACCESS_TYPE_WRITE); | ||
| 76 | if (ret) | ||
| 77 | goto finish_write; | ||
| 51 | 78 | ||
| 52 | host_file = cfi->cfi_container; | ||
| 53 | file_start_write(host_file); | 79 | file_start_write(host_file); |
| 54 | inode_lock(coda_inode); | 80 | inode_lock(coda_inode); |
| 55 | ret = vfs_iter_write(cfi->cfi_container, to, &iocb->ki_pos, 0); | 81 | ret = vfs_iter_write(cfi->cfi_container, to, &iocb->ki_pos, 0); |
| @@ -58,26 +84,73 @@ coda_file_write_iter(struct kiocb *iocb, struct iov_iter *to) | |||
| 58 | coda_inode->i_mtime = coda_inode->i_ctime = current_time(coda_inode); | 84 | coda_inode->i_mtime = coda_inode->i_ctime = current_time(coda_inode); |
| 59 | inode_unlock(coda_inode); | 85 | inode_unlock(coda_inode); |
| 60 | file_end_write(host_file); | 86 | file_end_write(host_file); |
| 87 | |||
| 88 | finish_write: | ||
| 89 | venus_access_intent(coda_inode->i_sb, coda_i2f(coda_inode), | ||
| 90 | &cfi->cfi_access_intent, | ||
| 91 | count, ki_pos, CODA_ACCESS_TYPE_WRITE_FINISH); | ||
| 61 | return ret; | 92 | return ret; |
| 62 | } | 93 | } |
| 63 | 94 | ||
| 95 | static void | ||
| 96 | coda_vm_open(struct vm_area_struct *vma) | ||
| 97 | { | ||
| 98 | struct coda_vm_ops *cvm_ops = | ||
| 99 | container_of(vma->vm_ops, struct coda_vm_ops, vm_ops); | ||
| 100 | |||
| 101 | atomic_inc(&cvm_ops->refcnt); | ||
| 102 | |||
| 103 | if (cvm_ops->host_vm_ops && cvm_ops->host_vm_ops->open) | ||
| 104 | cvm_ops->host_vm_ops->open(vma); | ||
| 105 | } | ||
| 106 | |||
| 107 | static void | ||
| 108 | coda_vm_close(struct vm_area_struct *vma) | ||
| 109 | { | ||
| 110 | struct coda_vm_ops *cvm_ops = | ||
| 111 | container_of(vma->vm_ops, struct coda_vm_ops, vm_ops); | ||
| 112 | |||
| 113 | if (cvm_ops->host_vm_ops && cvm_ops->host_vm_ops->close) | ||
| 114 | cvm_ops->host_vm_ops->close(vma); | ||
| 115 | |||
| 116 | if (atomic_dec_and_test(&cvm_ops->refcnt)) { | ||
| 117 | vma->vm_ops = cvm_ops->host_vm_ops; | ||
| 118 | fput(cvm_ops->coda_file); | ||
| 119 | kfree(cvm_ops); | ||
| 120 | } | ||
| 121 | } | ||
| 122 | |||
| 64 | static int | 123 | static int |
| 65 | coda_file_mmap(struct file *coda_file, struct vm_area_struct *vma) | 124 | coda_file_mmap(struct file *coda_file, struct vm_area_struct *vma) |
| 66 | { | 125 | { |
| 67 | struct coda_file_info *cfi; | 126 | struct inode *coda_inode = file_inode(coda_file); |
| 127 | struct coda_file_info *cfi = coda_ftoc(coda_file); | ||
| 128 | struct file *host_file = cfi->cfi_container; | ||
| 129 | struct inode *host_inode = file_inode(host_file); | ||
| 68 | struct coda_inode_info *cii; | 130 | struct coda_inode_info *cii; |
| 69 | struct file *host_file; | 131 | struct coda_vm_ops *cvm_ops; |
| 70 | struct inode *coda_inode, *host_inode; | 132 | loff_t ppos; |
| 71 | 133 | size_t count; | |
| 72 | cfi = CODA_FTOC(coda_file); | 134 | int ret; |
| 73 | BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC); | ||
| 74 | host_file = cfi->cfi_container; | ||
| 75 | 135 | ||
| 76 | if (!host_file->f_op->mmap) | 136 | if (!host_file->f_op->mmap) |
| 77 | return -ENODEV; | 137 | return -ENODEV; |
| 78 | 138 | ||
| 79 | coda_inode = file_inode(coda_file); | 139 | if (WARN_ON(coda_file != vma->vm_file)) |
| 80 | host_inode = file_inode(host_file); | 140 | return -EIO; |
| 141 | |||
| 142 | count = vma->vm_end - vma->vm_start; | ||
| 143 | ppos = vma->vm_pgoff * PAGE_SIZE; | ||
| 144 | |||
| 145 | ret = venus_access_intent(coda_inode->i_sb, coda_i2f(coda_inode), | ||
| 146 | &cfi->cfi_access_intent, | ||
| 147 | count, ppos, CODA_ACCESS_TYPE_MMAP); | ||
| 148 | if (ret) | ||
| 149 | return ret; | ||
| 150 | |||
| 151 | cvm_ops = kmalloc(sizeof(struct coda_vm_ops), GFP_KERNEL); | ||
| 152 | if (!cvm_ops) | ||
| 153 | return -ENOMEM; | ||
| 81 | 154 | ||
| 82 | cii = ITOC(coda_inode); | 155 | cii = ITOC(coda_inode); |
| 83 | spin_lock(&cii->c_lock); | 156 | spin_lock(&cii->c_lock); |
| @@ -89,6 +162,7 @@ coda_file_mmap(struct file *coda_file, struct vm_area_struct *vma) | |||
| 89 | * the container file on us! */ | 162 | * the container file on us! */ |
| 90 | else if (coda_inode->i_mapping != host_inode->i_mapping) { | 163 | else if (coda_inode->i_mapping != host_inode->i_mapping) { |
| 91 | spin_unlock(&cii->c_lock); | 164 | spin_unlock(&cii->c_lock); |
| 165 | kfree(cvm_ops); | ||
| 92 | return -EBUSY; | 166 | return -EBUSY; |
| 93 | } | 167 | } |
| 94 | 168 | ||
| @@ -97,7 +171,29 @@ coda_file_mmap(struct file *coda_file, struct vm_area_struct *vma) | |||
| 97 | cfi->cfi_mapcount++; | 171 | cfi->cfi_mapcount++; |
| 98 | spin_unlock(&cii->c_lock); | 172 | spin_unlock(&cii->c_lock); |
| 99 | 173 | ||
| 100 | return call_mmap(host_file, vma); | 174 | vma->vm_file = get_file(host_file); |
| 175 | ret = call_mmap(vma->vm_file, vma); | ||
| 176 | |||
| 177 | if (ret) { | ||
| 178 | /* if call_mmap fails, our caller will put coda_file so we | ||
| 179 | * should drop the reference to the host_file that we got. | ||
| 180 | */ | ||
| 181 | fput(host_file); | ||
| 182 | kfree(cvm_ops); | ||
| 183 | } else { | ||
| 184 | /* here we add redirects for the open/close vm_operations */ | ||
| 185 | cvm_ops->host_vm_ops = vma->vm_ops; | ||
| 186 | if (vma->vm_ops) | ||
| 187 | cvm_ops->vm_ops = *vma->vm_ops; | ||
| 188 | |||
| 189 | cvm_ops->vm_ops.open = coda_vm_open; | ||
| 190 | cvm_ops->vm_ops.close = coda_vm_close; | ||
| 191 | cvm_ops->coda_file = coda_file; | ||
| 192 | atomic_set(&cvm_ops->refcnt, 1); | ||
| 193 | |||
| 194 | vma->vm_ops = &cvm_ops->vm_ops; | ||
| 195 | } | ||
| 196 | return ret; | ||
| 101 | } | 197 | } |
| 102 | 198 | ||
| 103 | int coda_open(struct inode *coda_inode, struct file *coda_file) | 199 | int coda_open(struct inode *coda_inode, struct file *coda_file) |
| @@ -127,6 +223,8 @@ int coda_open(struct inode *coda_inode, struct file *coda_file) | |||
| 127 | cfi->cfi_magic = CODA_MAGIC; | 223 | cfi->cfi_magic = CODA_MAGIC; |
| 128 | cfi->cfi_mapcount = 0; | 224 | cfi->cfi_mapcount = 0; |
| 129 | cfi->cfi_container = host_file; | 225 | cfi->cfi_container = host_file; |
| 226 | /* assume access intents are supported unless we hear otherwise */ | ||
| 227 | cfi->cfi_access_intent = true; | ||
| 130 | 228 | ||
| 131 | BUG_ON(coda_file->private_data != NULL); | 229 | BUG_ON(coda_file->private_data != NULL); |
| 132 | coda_file->private_data = cfi; | 230 | coda_file->private_data = cfi; |
| @@ -142,8 +240,7 @@ int coda_release(struct inode *coda_inode, struct file *coda_file) | |||
| 142 | struct inode *host_inode; | 240 | struct inode *host_inode; |
| 143 | int err; | 241 | int err; |
| 144 | 242 | ||
| 145 | cfi = CODA_FTOC(coda_file); | 243 | cfi = coda_ftoc(coda_file); |
| 146 | BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC); | ||
| 147 | 244 | ||
| 148 | err = venus_close(coda_inode->i_sb, coda_i2f(coda_inode), | 245 | err = venus_close(coda_inode->i_sb, coda_i2f(coda_inode), |
| 149 | coda_flags, coda_file->f_cred->fsuid); | 246 | coda_flags, coda_file->f_cred->fsuid); |
| @@ -185,8 +282,7 @@ int coda_fsync(struct file *coda_file, loff_t start, loff_t end, int datasync) | |||
| 185 | return err; | 282 | return err; |
| 186 | inode_lock(coda_inode); | 283 | inode_lock(coda_inode); |
| 187 | 284 | ||
| 188 | cfi = CODA_FTOC(coda_file); | 285 | cfi = coda_ftoc(coda_file); |
| 189 | BUG_ON(!cfi || cfi->cfi_magic != CODA_MAGIC); | ||
| 190 | host_file = cfi->cfi_container; | 286 | host_file = cfi->cfi_container; |
| 191 | 287 | ||
| 192 | err = vfs_fsync(host_file, datasync); | 288 | err = vfs_fsync(host_file, datasync); |
| @@ -207,4 +303,3 @@ const struct file_operations coda_file_operations = { | |||
| 207 | .fsync = coda_fsync, | 303 | .fsync = coda_fsync, |
| 208 | .splice_read = generic_file_splice_read, | 304 | .splice_read = generic_file_splice_read, |
| 209 | }; | 305 | }; |
| 210 | |||
diff --git a/fs/coda/inode.c b/fs/coda/inode.c index 23f6ebd08e80..321f56e487cb 100644 --- a/fs/coda/inode.c +++ b/fs/coda/inode.c | |||
| @@ -27,7 +27,7 @@ | |||
| 27 | #include <linux/vmalloc.h> | 27 | #include <linux/vmalloc.h> |
| 28 | 28 | ||
| 29 | #include <linux/coda.h> | 29 | #include <linux/coda.h> |
| 30 | #include <linux/coda_psdev.h> | 30 | #include "coda_psdev.h" |
| 31 | #include "coda_linux.h" | 31 | #include "coda_linux.h" |
| 32 | #include "coda_cache.h" | 32 | #include "coda_cache.h" |
| 33 | 33 | ||
| @@ -236,6 +236,7 @@ static void coda_put_super(struct super_block *sb) | |||
| 236 | vcp->vc_sb = NULL; | 236 | vcp->vc_sb = NULL; |
| 237 | sb->s_fs_info = NULL; | 237 | sb->s_fs_info = NULL; |
| 238 | mutex_unlock(&vcp->vc_mutex); | 238 | mutex_unlock(&vcp->vc_mutex); |
| 239 | mutex_destroy(&vcp->vc_mutex); | ||
| 239 | 240 | ||
| 240 | pr_info("Bye bye.\n"); | 241 | pr_info("Bye bye.\n"); |
| 241 | } | 242 | } |
diff --git a/fs/coda/pioctl.c b/fs/coda/pioctl.c index e0c17b7dccce..644d48c12ce8 100644 --- a/fs/coda/pioctl.c +++ b/fs/coda/pioctl.c | |||
| @@ -20,8 +20,7 @@ | |||
| 20 | #include <linux/uaccess.h> | 20 | #include <linux/uaccess.h> |
| 21 | 21 | ||
| 22 | #include <linux/coda.h> | 22 | #include <linux/coda.h> |
| 23 | #include <linux/coda_psdev.h> | 23 | #include "coda_psdev.h" |
| 24 | |||
| 25 | #include "coda_linux.h" | 24 | #include "coda_linux.h" |
| 26 | 25 | ||
| 27 | /* pioctl ops */ | 26 | /* pioctl ops */ |
diff --git a/fs/coda/psdev.c b/fs/coda/psdev.c index 0ceef32e6fae..240669f51eac 100644 --- a/fs/coda/psdev.c +++ b/fs/coda/psdev.c | |||
| @@ -38,8 +38,7 @@ | |||
| 38 | #include <linux/uaccess.h> | 38 | #include <linux/uaccess.h> |
| 39 | 39 | ||
| 40 | #include <linux/coda.h> | 40 | #include <linux/coda.h> |
| 41 | #include <linux/coda_psdev.h> | 41 | #include "coda_psdev.h" |
| 42 | |||
| 43 | #include "coda_linux.h" | 42 | #include "coda_linux.h" |
| 44 | 43 | ||
| 45 | #include "coda_int.h" | 44 | #include "coda_int.h" |
| @@ -100,8 +99,12 @@ static ssize_t coda_psdev_write(struct file *file, const char __user *buf, | |||
| 100 | ssize_t retval = 0, count = 0; | 99 | ssize_t retval = 0, count = 0; |
| 101 | int error; | 100 | int error; |
| 102 | 101 | ||
| 102 | /* make sure there is enough to copy out the (opcode, unique) values */ | ||
| 103 | if (nbytes < (2 * sizeof(u_int32_t))) | ||
| 104 | return -EINVAL; | ||
| 105 | |||
| 103 | /* Peek at the opcode, uniquefier */ | 106 | /* Peek at the opcode, uniquefier */ |
| 104 | if (copy_from_user(&hdr, buf, 2 * sizeof(u_long))) | 107 | if (copy_from_user(&hdr, buf, 2 * sizeof(u_int32_t))) |
| 105 | return -EFAULT; | 108 | return -EFAULT; |
| 106 | 109 | ||
| 107 | if (DOWNCALL(hdr.opcode)) { | 110 | if (DOWNCALL(hdr.opcode)) { |
| @@ -119,17 +122,21 @@ static ssize_t coda_psdev_write(struct file *file, const char __user *buf, | |||
| 119 | hdr.opcode, hdr.unique); | 122 | hdr.opcode, hdr.unique); |
| 120 | nbytes = size; | 123 | nbytes = size; |
| 121 | } | 124 | } |
| 122 | CODA_ALLOC(dcbuf, union outputArgs *, nbytes); | 125 | dcbuf = kvmalloc(nbytes, GFP_KERNEL); |
| 126 | if (!dcbuf) { | ||
| 127 | retval = -ENOMEM; | ||
| 128 | goto out; | ||
| 129 | } | ||
| 123 | if (copy_from_user(dcbuf, buf, nbytes)) { | 130 | if (copy_from_user(dcbuf, buf, nbytes)) { |
| 124 | CODA_FREE(dcbuf, nbytes); | 131 | kvfree(dcbuf); |
| 125 | retval = -EFAULT; | 132 | retval = -EFAULT; |
| 126 | goto out; | 133 | goto out; |
| 127 | } | 134 | } |
| 128 | 135 | ||
| 129 | /* what downcall errors does Venus handle ? */ | 136 | /* what downcall errors does Venus handle ? */ |
| 130 | error = coda_downcall(vcp, hdr.opcode, dcbuf); | 137 | error = coda_downcall(vcp, hdr.opcode, dcbuf, nbytes); |
| 131 | 138 | ||
| 132 | CODA_FREE(dcbuf, nbytes); | 139 | kvfree(dcbuf); |
| 133 | if (error) { | 140 | if (error) { |
| 134 | pr_warn("%s: coda_downcall error: %d\n", | 141 | pr_warn("%s: coda_downcall error: %d\n", |
| 135 | __func__, error); | 142 | __func__, error); |
| @@ -182,8 +189,11 @@ static ssize_t coda_psdev_write(struct file *file, const char __user *buf, | |||
| 182 | if (req->uc_opcode == CODA_OPEN_BY_FD) { | 189 | if (req->uc_opcode == CODA_OPEN_BY_FD) { |
| 183 | struct coda_open_by_fd_out *outp = | 190 | struct coda_open_by_fd_out *outp = |
| 184 | (struct coda_open_by_fd_out *)req->uc_data; | 191 | (struct coda_open_by_fd_out *)req->uc_data; |
| 185 | if (!outp->oh.result) | 192 | if (!outp->oh.result) { |
| 186 | outp->fh = fget(outp->fd); | 193 | outp->fh = fget(outp->fd); |
| 194 | if (!outp->fh) | ||
| 195 | return -EBADF; | ||
| 196 | } | ||
| 187 | } | 197 | } |
| 188 | 198 | ||
| 189 | wake_up(&req->uc_sleep); | 199 | wake_up(&req->uc_sleep); |
| @@ -252,7 +262,7 @@ static ssize_t coda_psdev_read(struct file * file, char __user * buf, | |||
| 252 | goto out; | 262 | goto out; |
| 253 | } | 263 | } |
| 254 | 264 | ||
| 255 | CODA_FREE(req->uc_data, sizeof(struct coda_in_hdr)); | 265 | kvfree(req->uc_data); |
| 256 | kfree(req); | 266 | kfree(req); |
| 257 | out: | 267 | out: |
| 258 | mutex_unlock(&vcp->vc_mutex); | 268 | mutex_unlock(&vcp->vc_mutex); |
| @@ -314,7 +324,7 @@ static int coda_psdev_release(struct inode * inode, struct file * file) | |||
| 314 | 324 | ||
| 315 | /* Async requests need to be freed here */ | 325 | /* Async requests need to be freed here */ |
| 316 | if (req->uc_flags & CODA_REQ_ASYNC) { | 326 | if (req->uc_flags & CODA_REQ_ASYNC) { |
| 317 | CODA_FREE(req->uc_data, sizeof(struct coda_in_hdr)); | 327 | kvfree(req->uc_data); |
| 318 | kfree(req); | 328 | kfree(req); |
| 319 | continue; | 329 | continue; |
| 320 | } | 330 | } |
| @@ -347,13 +357,13 @@ static const struct file_operations coda_psdev_fops = { | |||
| 347 | .llseek = noop_llseek, | 357 | .llseek = noop_llseek, |
| 348 | }; | 358 | }; |
| 349 | 359 | ||
| 350 | static int init_coda_psdev(void) | 360 | static int __init init_coda_psdev(void) |
| 351 | { | 361 | { |
| 352 | int i, err = 0; | 362 | int i, err = 0; |
| 353 | if (register_chrdev(CODA_PSDEV_MAJOR, "coda", &coda_psdev_fops)) { | 363 | if (register_chrdev(CODA_PSDEV_MAJOR, "coda", &coda_psdev_fops)) { |
| 354 | pr_err("%s: unable to get major %d\n", | 364 | pr_err("%s: unable to get major %d\n", |
| 355 | __func__, CODA_PSDEV_MAJOR); | 365 | __func__, CODA_PSDEV_MAJOR); |
| 356 | return -EIO; | 366 | return -EIO; |
| 357 | } | 367 | } |
| 358 | coda_psdev_class = class_create(THIS_MODULE, "coda"); | 368 | coda_psdev_class = class_create(THIS_MODULE, "coda"); |
| 359 | if (IS_ERR(coda_psdev_class)) { | 369 | if (IS_ERR(coda_psdev_class)) { |
| @@ -378,7 +388,7 @@ MODULE_AUTHOR("Jan Harkes, Peter J. Braam"); | |||
| 378 | MODULE_DESCRIPTION("Coda Distributed File System VFS interface"); | 388 | MODULE_DESCRIPTION("Coda Distributed File System VFS interface"); |
| 379 | MODULE_ALIAS_CHARDEV_MAJOR(CODA_PSDEV_MAJOR); | 389 | MODULE_ALIAS_CHARDEV_MAJOR(CODA_PSDEV_MAJOR); |
| 380 | MODULE_LICENSE("GPL"); | 390 | MODULE_LICENSE("GPL"); |
| 381 | MODULE_VERSION("6.6"); | 391 | MODULE_VERSION("7.0"); |
| 382 | 392 | ||
| 383 | static int __init init_coda(void) | 393 | static int __init init_coda(void) |
| 384 | { | 394 | { |
diff --git a/fs/coda/symlink.c b/fs/coda/symlink.c index 202297d156df..8907d0508198 100644 --- a/fs/coda/symlink.c +++ b/fs/coda/symlink.c | |||
| @@ -17,8 +17,7 @@ | |||
| 17 | #include <linux/pagemap.h> | 17 | #include <linux/pagemap.h> |
| 18 | 18 | ||
| 19 | #include <linux/coda.h> | 19 | #include <linux/coda.h> |
| 20 | #include <linux/coda_psdev.h> | 20 | #include "coda_psdev.h" |
| 21 | |||
| 22 | #include "coda_linux.h" | 21 | #include "coda_linux.h" |
| 23 | 22 | ||
| 24 | static int coda_symlink_filler(struct file *file, struct page *page) | 23 | static int coda_symlink_filler(struct file *file, struct page *page) |
diff --git a/fs/coda/sysctl.c b/fs/coda/sysctl.c index 0301d45000a8..fda3b702b1c5 100644 --- a/fs/coda/sysctl.c +++ b/fs/coda/sysctl.c | |||
| @@ -12,7 +12,6 @@ | |||
| 12 | 12 | ||
| 13 | #include "coda_int.h" | 13 | #include "coda_int.h" |
| 14 | 14 | ||
| 15 | #ifdef CONFIG_SYSCTL | ||
| 16 | static struct ctl_table_header *fs_table_header; | 15 | static struct ctl_table_header *fs_table_header; |
| 17 | 16 | ||
| 18 | static struct ctl_table coda_table[] = { | 17 | static struct ctl_table coda_table[] = { |
| @@ -62,13 +61,3 @@ void coda_sysctl_clean(void) | |||
| 62 | fs_table_header = NULL; | 61 | fs_table_header = NULL; |
| 63 | } | 62 | } |
| 64 | } | 63 | } |
| 65 | |||
| 66 | #else | ||
| 67 | void coda_sysctl_init(void) | ||
| 68 | { | ||
| 69 | } | ||
| 70 | |||
| 71 | void coda_sysctl_clean(void) | ||
| 72 | { | ||
| 73 | } | ||
| 74 | #endif | ||
diff --git a/fs/coda/upcall.c b/fs/coda/upcall.c index 1175a1722411..eb3b1898da46 100644 --- a/fs/coda/upcall.c +++ b/fs/coda/upcall.c | |||
| @@ -33,7 +33,7 @@ | |||
| 33 | #include <linux/vfs.h> | 33 | #include <linux/vfs.h> |
| 34 | 34 | ||
| 35 | #include <linux/coda.h> | 35 | #include <linux/coda.h> |
| 36 | #include <linux/coda_psdev.h> | 36 | #include "coda_psdev.h" |
| 37 | #include "coda_linux.h" | 37 | #include "coda_linux.h" |
| 38 | #include "coda_cache.h" | 38 | #include "coda_cache.h" |
| 39 | 39 | ||
| @@ -46,7 +46,7 @@ static void *alloc_upcall(int opcode, int size) | |||
| 46 | { | 46 | { |
| 47 | union inputArgs *inp; | 47 | union inputArgs *inp; |
| 48 | 48 | ||
| 49 | CODA_ALLOC(inp, union inputArgs *, size); | 49 | inp = kvzalloc(size, GFP_KERNEL); |
| 50 | if (!inp) | 50 | if (!inp) |
| 51 | return ERR_PTR(-ENOMEM); | 51 | return ERR_PTR(-ENOMEM); |
| 52 | 52 | ||
| @@ -85,7 +85,7 @@ int venus_rootfid(struct super_block *sb, struct CodaFid *fidp) | |||
| 85 | if (!error) | 85 | if (!error) |
| 86 | *fidp = outp->coda_root.VFid; | 86 | *fidp = outp->coda_root.VFid; |
| 87 | 87 | ||
| 88 | CODA_FREE(inp, insize); | 88 | kvfree(inp); |
| 89 | return error; | 89 | return error; |
| 90 | } | 90 | } |
| 91 | 91 | ||
| @@ -104,7 +104,7 @@ int venus_getattr(struct super_block *sb, struct CodaFid *fid, | |||
| 104 | if (!error) | 104 | if (!error) |
| 105 | *attr = outp->coda_getattr.attr; | 105 | *attr = outp->coda_getattr.attr; |
| 106 | 106 | ||
| 107 | CODA_FREE(inp, insize); | 107 | kvfree(inp); |
| 108 | return error; | 108 | return error; |
| 109 | } | 109 | } |
| 110 | 110 | ||
| @@ -123,7 +123,7 @@ int venus_setattr(struct super_block *sb, struct CodaFid *fid, | |||
| 123 | 123 | ||
| 124 | error = coda_upcall(coda_vcp(sb), insize, &outsize, inp); | 124 | error = coda_upcall(coda_vcp(sb), insize, &outsize, inp); |
| 125 | 125 | ||
| 126 | CODA_FREE(inp, insize); | 126 | kvfree(inp); |
| 127 | return error; | 127 | return error; |
| 128 | } | 128 | } |
| 129 | 129 | ||
| @@ -153,7 +153,7 @@ int venus_lookup(struct super_block *sb, struct CodaFid *fid, | |||
| 153 | *type = outp->coda_lookup.vtype; | 153 | *type = outp->coda_lookup.vtype; |
| 154 | } | 154 | } |
| 155 | 155 | ||
| 156 | CODA_FREE(inp, insize); | 156 | kvfree(inp); |
| 157 | return error; | 157 | return error; |
| 158 | } | 158 | } |
| 159 | 159 | ||
| @@ -173,7 +173,7 @@ int venus_close(struct super_block *sb, struct CodaFid *fid, int flags, | |||
| 173 | 173 | ||
| 174 | error = coda_upcall(coda_vcp(sb), insize, &outsize, inp); | 174 | error = coda_upcall(coda_vcp(sb), insize, &outsize, inp); |
| 175 | 175 | ||
| 176 | CODA_FREE(inp, insize); | 176 | kvfree(inp); |
| 177 | return error; | 177 | return error; |
| 178 | } | 178 | } |
| 179 | 179 | ||
| @@ -194,7 +194,7 @@ int venus_open(struct super_block *sb, struct CodaFid *fid, | |||
| 194 | if (!error) | 194 | if (!error) |
| 195 | *fh = outp->coda_open_by_fd.fh; | 195 | *fh = outp->coda_open_by_fd.fh; |
| 196 | 196 | ||
| 197 | CODA_FREE(inp, insize); | 197 | kvfree(inp); |
| 198 | return error; | 198 | return error; |
| 199 | } | 199 | } |
| 200 | 200 | ||
| @@ -224,7 +224,7 @@ int venus_mkdir(struct super_block *sb, struct CodaFid *dirfid, | |||
| 224 | *newfid = outp->coda_mkdir.VFid; | 224 | *newfid = outp->coda_mkdir.VFid; |
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | CODA_FREE(inp, insize); | 227 | kvfree(inp); |
| 228 | return error; | 228 | return error; |
| 229 | } | 229 | } |
| 230 | 230 | ||
| @@ -262,7 +262,7 @@ int venus_rename(struct super_block *sb, struct CodaFid *old_fid, | |||
| 262 | 262 | ||
| 263 | error = coda_upcall(coda_vcp(sb), insize, &outsize, inp); | 263 | error = coda_upcall(coda_vcp(sb), insize, &outsize, inp); |
| 264 | 264 | ||
| 265 | CODA_FREE(inp, insize); | 265 | kvfree(inp); |
| 266 | return error; | 266 | return error; |
| 267 | } | 267 | } |
| 268 | 268 | ||
| @@ -295,7 +295,7 @@ int venus_create(struct super_block *sb, struct CodaFid *dirfid, | |||
| 295 | *newfid = outp->coda_create.VFid; | 295 | *newfid = outp->coda_create.VFid; |
| 296 | } | 296 | } |
| 297 | 297 | ||
| 298 | CODA_FREE(inp, insize); | 298 | kvfree(inp); |
| 299 | return error; | 299 | return error; |
| 300 | } | 300 | } |
| 301 | 301 | ||
| @@ -318,7 +318,7 @@ int venus_rmdir(struct super_block *sb, struct CodaFid *dirfid, | |||
| 318 | 318 | ||
| 319 | error = coda_upcall(coda_vcp(sb), insize, &outsize, inp); | 319 | error = coda_upcall(coda_vcp(sb), insize, &outsize, inp); |
| 320 | 320 | ||
| 321 | CODA_FREE(inp, insize); | 321 | kvfree(inp); |
| 322 | return error; | 322 | return error; |
| 323 | } | 323 | } |
| 324 | 324 | ||
| @@ -340,7 +340,7 @@ int venus_remove(struct super_block *sb, struct CodaFid *dirfid, | |||
| 340 | 340 | ||
| 341 | error = coda_upcall(coda_vcp(sb), insize, &outsize, inp); | 341 | error = coda_upcall(coda_vcp(sb), insize, &outsize, inp); |
| 342 | 342 | ||
| 343 | CODA_FREE(inp, insize); | 343 | kvfree(inp); |
| 344 | return error; | 344 | return error; |
| 345 | } | 345 | } |
| 346 | 346 | ||
| @@ -370,7 +370,7 @@ int venus_readlink(struct super_block *sb, struct CodaFid *fid, | |||
| 370 | *(buffer + retlen) = '\0'; | 370 | *(buffer + retlen) = '\0'; |
| 371 | } | 371 | } |
| 372 | 372 | ||
| 373 | CODA_FREE(inp, insize); | 373 | kvfree(inp); |
| 374 | return error; | 374 | return error; |
| 375 | } | 375 | } |
| 376 | 376 | ||
| @@ -398,7 +398,7 @@ int venus_link(struct super_block *sb, struct CodaFid *fid, | |||
| 398 | 398 | ||
| 399 | error = coda_upcall(coda_vcp(sb), insize, &outsize, inp); | 399 | error = coda_upcall(coda_vcp(sb), insize, &outsize, inp); |
| 400 | 400 | ||
| 401 | CODA_FREE(inp, insize); | 401 | kvfree(inp); |
| 402 | return error; | 402 | return error; |
| 403 | } | 403 | } |
| 404 | 404 | ||
| @@ -433,7 +433,7 @@ int venus_symlink(struct super_block *sb, struct CodaFid *fid, | |||
| 433 | 433 | ||
| 434 | error = coda_upcall(coda_vcp(sb), insize, &outsize, inp); | 434 | error = coda_upcall(coda_vcp(sb), insize, &outsize, inp); |
| 435 | 435 | ||
| 436 | CODA_FREE(inp, insize); | 436 | kvfree(inp); |
| 437 | return error; | 437 | return error; |
| 438 | } | 438 | } |
| 439 | 439 | ||
| @@ -449,7 +449,7 @@ int venus_fsync(struct super_block *sb, struct CodaFid *fid) | |||
| 449 | inp->coda_fsync.VFid = *fid; | 449 | inp->coda_fsync.VFid = *fid; |
| 450 | error = coda_upcall(coda_vcp(sb), insize, &outsize, inp); | 450 | error = coda_upcall(coda_vcp(sb), insize, &outsize, inp); |
| 451 | 451 | ||
| 452 | CODA_FREE(inp, insize); | 452 | kvfree(inp); |
| 453 | return error; | 453 | return error; |
| 454 | } | 454 | } |
| 455 | 455 | ||
| @@ -467,7 +467,7 @@ int venus_access(struct super_block *sb, struct CodaFid *fid, int mask) | |||
| 467 | 467 | ||
| 468 | error = coda_upcall(coda_vcp(sb), insize, &outsize, inp); | 468 | error = coda_upcall(coda_vcp(sb), insize, &outsize, inp); |
| 469 | 469 | ||
| 470 | CODA_FREE(inp, insize); | 470 | kvfree(inp); |
| 471 | return error; | 471 | return error; |
| 472 | } | 472 | } |
| 473 | 473 | ||
| @@ -543,7 +543,7 @@ int venus_pioctl(struct super_block *sb, struct CodaFid *fid, | |||
| 543 | } | 543 | } |
| 544 | 544 | ||
| 545 | exit: | 545 | exit: |
| 546 | CODA_FREE(inp, insize); | 546 | kvfree(inp); |
| 547 | return error; | 547 | return error; |
| 548 | } | 548 | } |
| 549 | 549 | ||
| @@ -553,7 +553,7 @@ int venus_statfs(struct dentry *dentry, struct kstatfs *sfs) | |||
| 553 | union outputArgs *outp; | 553 | union outputArgs *outp; |
| 554 | int insize, outsize, error; | 554 | int insize, outsize, error; |
| 555 | 555 | ||
| 556 | insize = max_t(unsigned int, INSIZE(statfs), OUTSIZE(statfs)); | 556 | insize = SIZE(statfs); |
| 557 | UPARG(CODA_STATFS); | 557 | UPARG(CODA_STATFS); |
| 558 | 558 | ||
| 559 | error = coda_upcall(coda_vcp(dentry->d_sb), insize, &outsize, inp); | 559 | error = coda_upcall(coda_vcp(dentry->d_sb), insize, &outsize, inp); |
| @@ -565,10 +565,51 @@ int venus_statfs(struct dentry *dentry, struct kstatfs *sfs) | |||
| 565 | sfs->f_ffree = outp->coda_statfs.stat.f_ffree; | 565 | sfs->f_ffree = outp->coda_statfs.stat.f_ffree; |
| 566 | } | 566 | } |
| 567 | 567 | ||
| 568 | CODA_FREE(inp, insize); | 568 | kvfree(inp); |
| 569 | return error; | 569 | return error; |
| 570 | } | 570 | } |
| 571 | 571 | ||
| 572 | int venus_access_intent(struct super_block *sb, struct CodaFid *fid, | ||
| 573 | bool *access_intent_supported, | ||
| 574 | size_t count, loff_t ppos, int type) | ||
| 575 | { | ||
| 576 | union inputArgs *inp; | ||
| 577 | union outputArgs *outp; | ||
| 578 | int insize, outsize, error; | ||
| 579 | bool finalizer = | ||
| 580 | type == CODA_ACCESS_TYPE_READ_FINISH || | ||
| 581 | type == CODA_ACCESS_TYPE_WRITE_FINISH; | ||
| 582 | |||
| 583 | if (!*access_intent_supported && !finalizer) | ||
| 584 | return 0; | ||
| 585 | |||
| 586 | insize = SIZE(access_intent); | ||
| 587 | UPARG(CODA_ACCESS_INTENT); | ||
| 588 | |||
| 589 | inp->coda_access_intent.VFid = *fid; | ||
| 590 | inp->coda_access_intent.count = count; | ||
| 591 | inp->coda_access_intent.pos = ppos; | ||
| 592 | inp->coda_access_intent.type = type; | ||
| 593 | |||
| 594 | error = coda_upcall(coda_vcp(sb), insize, | ||
| 595 | finalizer ? NULL : &outsize, inp); | ||
| 596 | |||
| 597 | /* | ||
| 598 | * we have to free the request buffer for synchronous upcalls | ||
| 599 | * or when asynchronous upcalls fail, but not when asynchronous | ||
| 600 | * upcalls succeed | ||
| 601 | */ | ||
| 602 | if (!finalizer || error) | ||
| 603 | kvfree(inp); | ||
| 604 | |||
| 605 | /* Chunked access is not supported or an old Coda client */ | ||
| 606 | if (error == -EOPNOTSUPP) { | ||
| 607 | *access_intent_supported = false; | ||
| 608 | error = 0; | ||
| 609 | } | ||
| 610 | return error; | ||
| 611 | } | ||
| 612 | |||
| 572 | /* | 613 | /* |
| 573 | * coda_upcall and coda_downcall routines. | 614 | * coda_upcall and coda_downcall routines. |
| 574 | */ | 615 | */ |
| @@ -598,10 +639,12 @@ static void coda_unblock_signals(sigset_t *old) | |||
| 598 | * has seen them, | 639 | * has seen them, |
| 599 | * - CODA_CLOSE or CODA_RELEASE upcall (to avoid reference count problems) | 640 | * - CODA_CLOSE or CODA_RELEASE upcall (to avoid reference count problems) |
| 600 | * - CODA_STORE (to avoid data loss) | 641 | * - CODA_STORE (to avoid data loss) |
| 642 | * - CODA_ACCESS_INTENT (to avoid reference count problems) | ||
| 601 | */ | 643 | */ |
| 602 | #define CODA_INTERRUPTIBLE(r) (!coda_hard && \ | 644 | #define CODA_INTERRUPTIBLE(r) (!coda_hard && \ |
| 603 | (((r)->uc_opcode != CODA_CLOSE && \ | 645 | (((r)->uc_opcode != CODA_CLOSE && \ |
| 604 | (r)->uc_opcode != CODA_STORE && \ | 646 | (r)->uc_opcode != CODA_STORE && \ |
| 647 | (r)->uc_opcode != CODA_ACCESS_INTENT && \ | ||
| 605 | (r)->uc_opcode != CODA_RELEASE) || \ | 648 | (r)->uc_opcode != CODA_RELEASE) || \ |
| 606 | (r)->uc_flags & CODA_REQ_READ)) | 649 | (r)->uc_flags & CODA_REQ_READ)) |
| 607 | 650 | ||
| @@ -687,21 +730,25 @@ static int coda_upcall(struct venus_comm *vcp, | |||
| 687 | goto exit; | 730 | goto exit; |
| 688 | } | 731 | } |
| 689 | 732 | ||
| 733 | buffer->ih.unique = ++vcp->vc_seq; | ||
| 734 | |||
| 690 | req->uc_data = (void *)buffer; | 735 | req->uc_data = (void *)buffer; |
| 691 | req->uc_flags = 0; | 736 | req->uc_flags = outSize ? 0 : CODA_REQ_ASYNC; |
| 692 | req->uc_inSize = inSize; | 737 | req->uc_inSize = inSize; |
| 693 | req->uc_outSize = *outSize ? *outSize : inSize; | 738 | req->uc_outSize = (outSize && *outSize) ? *outSize : inSize; |
| 694 | req->uc_opcode = ((union inputArgs *)buffer)->ih.opcode; | 739 | req->uc_opcode = buffer->ih.opcode; |
| 695 | req->uc_unique = ++vcp->vc_seq; | 740 | req->uc_unique = buffer->ih.unique; |
| 696 | init_waitqueue_head(&req->uc_sleep); | 741 | init_waitqueue_head(&req->uc_sleep); |
| 697 | 742 | ||
| 698 | /* Fill in the common input args. */ | ||
| 699 | ((union inputArgs *)buffer)->ih.unique = req->uc_unique; | ||
| 700 | |||
| 701 | /* Append msg to pending queue and poke Venus. */ | 743 | /* Append msg to pending queue and poke Venus. */ |
| 702 | list_add_tail(&req->uc_chain, &vcp->vc_pending); | 744 | list_add_tail(&req->uc_chain, &vcp->vc_pending); |
| 703 | |||
| 704 | wake_up_interruptible(&vcp->vc_waitq); | 745 | wake_up_interruptible(&vcp->vc_waitq); |
| 746 | |||
| 747 | if (req->uc_flags & CODA_REQ_ASYNC) { | ||
| 748 | mutex_unlock(&vcp->vc_mutex); | ||
| 749 | return 0; | ||
| 750 | } | ||
| 751 | |||
| 705 | /* We can be interrupted while we wait for Venus to process | 752 | /* We can be interrupted while we wait for Venus to process |
| 706 | * our request. If the interrupt occurs before Venus has read | 753 | * our request. If the interrupt occurs before Venus has read |
| 707 | * the request, we dequeue and return. If it occurs after the | 754 | * the request, we dequeue and return. If it occurs after the |
| @@ -743,20 +790,20 @@ static int coda_upcall(struct venus_comm *vcp, | |||
| 743 | sig_req = kmalloc(sizeof(struct upc_req), GFP_KERNEL); | 790 | sig_req = kmalloc(sizeof(struct upc_req), GFP_KERNEL); |
| 744 | if (!sig_req) goto exit; | 791 | if (!sig_req) goto exit; |
| 745 | 792 | ||
| 746 | CODA_ALLOC((sig_req->uc_data), char *, sizeof(struct coda_in_hdr)); | 793 | sig_inputArgs = kvzalloc(sizeof(struct coda_in_hdr), GFP_KERNEL); |
| 747 | if (!sig_req->uc_data) { | 794 | if (!sig_inputArgs) { |
| 748 | kfree(sig_req); | 795 | kfree(sig_req); |
| 749 | goto exit; | 796 | goto exit; |
| 750 | } | 797 | } |
| 751 | 798 | ||
| 752 | error = -EINTR; | 799 | error = -EINTR; |
| 753 | sig_inputArgs = (union inputArgs *)sig_req->uc_data; | ||
| 754 | sig_inputArgs->ih.opcode = CODA_SIGNAL; | 800 | sig_inputArgs->ih.opcode = CODA_SIGNAL; |
| 755 | sig_inputArgs->ih.unique = req->uc_unique; | 801 | sig_inputArgs->ih.unique = req->uc_unique; |
| 756 | 802 | ||
| 757 | sig_req->uc_flags = CODA_REQ_ASYNC; | 803 | sig_req->uc_flags = CODA_REQ_ASYNC; |
| 758 | sig_req->uc_opcode = sig_inputArgs->ih.opcode; | 804 | sig_req->uc_opcode = sig_inputArgs->ih.opcode; |
| 759 | sig_req->uc_unique = sig_inputArgs->ih.unique; | 805 | sig_req->uc_unique = sig_inputArgs->ih.unique; |
| 806 | sig_req->uc_data = (void *)sig_inputArgs; | ||
| 760 | sig_req->uc_inSize = sizeof(struct coda_in_hdr); | 807 | sig_req->uc_inSize = sizeof(struct coda_in_hdr); |
| 761 | sig_req->uc_outSize = sizeof(struct coda_in_hdr); | 808 | sig_req->uc_outSize = sizeof(struct coda_in_hdr); |
| 762 | 809 | ||
| @@ -804,12 +851,44 @@ exit: | |||
| 804 | * | 851 | * |
| 805 | * CODA_REPLACE -- replace one CodaFid with another throughout the name cache */ | 852 | * CODA_REPLACE -- replace one CodaFid with another throughout the name cache */ |
| 806 | 853 | ||
| 807 | int coda_downcall(struct venus_comm *vcp, int opcode, union outputArgs *out) | 854 | int coda_downcall(struct venus_comm *vcp, int opcode, union outputArgs *out, |
| 855 | size_t nbytes) | ||
| 808 | { | 856 | { |
| 809 | struct inode *inode = NULL; | 857 | struct inode *inode = NULL; |
| 810 | struct CodaFid *fid = NULL, *newfid; | 858 | struct CodaFid *fid = NULL, *newfid; |
| 811 | struct super_block *sb; | 859 | struct super_block *sb; |
| 812 | 860 | ||
| 861 | /* | ||
| 862 | * Make sure we have received enough data from the cache | ||
| 863 | * manager to populate the necessary fields in the buffer | ||
| 864 | */ | ||
| 865 | switch (opcode) { | ||
| 866 | case CODA_PURGEUSER: | ||
| 867 | if (nbytes < sizeof(struct coda_purgeuser_out)) | ||
| 868 | return -EINVAL; | ||
| 869 | break; | ||
| 870 | |||
| 871 | case CODA_ZAPDIR: | ||
| 872 | if (nbytes < sizeof(struct coda_zapdir_out)) | ||
| 873 | return -EINVAL; | ||
| 874 | break; | ||
| 875 | |||
| 876 | case CODA_ZAPFILE: | ||
| 877 | if (nbytes < sizeof(struct coda_zapfile_out)) | ||
| 878 | return -EINVAL; | ||
| 879 | break; | ||
| 880 | |||
| 881 | case CODA_PURGEFID: | ||
| 882 | if (nbytes < sizeof(struct coda_purgefid_out)) | ||
| 883 | return -EINVAL; | ||
| 884 | break; | ||
| 885 | |||
| 886 | case CODA_REPLACE: | ||
| 887 | if (nbytes < sizeof(struct coda_replace_out)) | ||
| 888 | return -EINVAL; | ||
| 889 | break; | ||
| 890 | } | ||
| 891 | |||
| 813 | /* Handle invalidation requests. */ | 892 | /* Handle invalidation requests. */ |
| 814 | mutex_lock(&vcp->vc_mutex); | 893 | mutex_lock(&vcp->vc_mutex); |
| 815 | sb = vcp->vc_sb; | 894 | sb = vcp->vc_sb; |
| @@ -879,4 +958,3 @@ unlock_out: | |||
| 879 | iput(inode); | 958 | iput(inode); |
| 880 | return 0; | 959 | return 0; |
| 881 | } | 960 | } |
| 882 | |||
diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 4c74c768ae43..0f9c073d78d5 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c | |||
| @@ -2313,19 +2313,17 @@ SYSCALL_DEFINE6(epoll_pwait, int, epfd, struct epoll_event __user *, events, | |||
| 2313 | size_t, sigsetsize) | 2313 | size_t, sigsetsize) |
| 2314 | { | 2314 | { |
| 2315 | int error; | 2315 | int error; |
| 2316 | sigset_t ksigmask, sigsaved; | ||
| 2317 | 2316 | ||
| 2318 | /* | 2317 | /* |
| 2319 | * If the caller wants a certain signal mask to be set during the wait, | 2318 | * If the caller wants a certain signal mask to be set during the wait, |
| 2320 | * we apply it here. | 2319 | * we apply it here. |
| 2321 | */ | 2320 | */ |
| 2322 | error = set_user_sigmask(sigmask, &ksigmask, &sigsaved, sigsetsize); | 2321 | error = set_user_sigmask(sigmask, sigsetsize); |
| 2323 | if (error) | 2322 | if (error) |
| 2324 | return error; | 2323 | return error; |
| 2325 | 2324 | ||
| 2326 | error = do_epoll_wait(epfd, events, maxevents, timeout); | 2325 | error = do_epoll_wait(epfd, events, maxevents, timeout); |
| 2327 | 2326 | restore_saved_sigmask_unless(error == -EINTR); | |
| 2328 | restore_user_sigmask(sigmask, &sigsaved, error == -EINTR); | ||
| 2329 | 2327 | ||
| 2330 | return error; | 2328 | return error; |
| 2331 | } | 2329 | } |
| @@ -2338,19 +2336,17 @@ COMPAT_SYSCALL_DEFINE6(epoll_pwait, int, epfd, | |||
| 2338 | compat_size_t, sigsetsize) | 2336 | compat_size_t, sigsetsize) |
| 2339 | { | 2337 | { |
| 2340 | long err; | 2338 | long err; |
| 2341 | sigset_t ksigmask, sigsaved; | ||
| 2342 | 2339 | ||
| 2343 | /* | 2340 | /* |
| 2344 | * If the caller wants a certain signal mask to be set during the wait, | 2341 | * If the caller wants a certain signal mask to be set during the wait, |
| 2345 | * we apply it here. | 2342 | * we apply it here. |
| 2346 | */ | 2343 | */ |
| 2347 | err = set_compat_user_sigmask(sigmask, &ksigmask, &sigsaved, sigsetsize); | 2344 | err = set_compat_user_sigmask(sigmask, sigsetsize); |
| 2348 | if (err) | 2345 | if (err) |
| 2349 | return err; | 2346 | return err; |
| 2350 | 2347 | ||
| 2351 | err = do_epoll_wait(epfd, events, maxevents, timeout); | 2348 | err = do_epoll_wait(epfd, events, maxevents, timeout); |
| 2352 | 2349 | restore_saved_sigmask_unless(err == -EINTR); | |
| 2353 | restore_user_sigmask(sigmask, &sigsaved, err == -EINTR); | ||
| 2354 | 2350 | ||
| 2355 | return err; | 2351 | return err; |
| 2356 | } | 2352 | } |
diff --git a/fs/hfsplus/xattr.c b/fs/hfsplus/xattr.c index d5403b4004c9..bb0b27d88e50 100644 --- a/fs/hfsplus/xattr.c +++ b/fs/hfsplus/xattr.c | |||
| @@ -407,7 +407,7 @@ static int copy_name(char *buffer, const char *xattr_name, int name_len) | |||
| 407 | int offset = 0; | 407 | int offset = 0; |
| 408 | 408 | ||
| 409 | if (!is_known_namespace(xattr_name)) { | 409 | if (!is_known_namespace(xattr_name)) { |
| 410 | strncpy(buffer, XATTR_MAC_OSX_PREFIX, XATTR_MAC_OSX_PREFIX_LEN); | 410 | memcpy(buffer, XATTR_MAC_OSX_PREFIX, XATTR_MAC_OSX_PREFIX_LEN); |
| 411 | offset += XATTR_MAC_OSX_PREFIX_LEN; | 411 | offset += XATTR_MAC_OSX_PREFIX_LEN; |
| 412 | len += XATTR_MAC_OSX_PREFIX_LEN; | 412 | len += XATTR_MAC_OSX_PREFIX_LEN; |
| 413 | } | 413 | } |
diff --git a/fs/io_uring.c b/fs/io_uring.c index d682049c07b2..e2a66e12fbc6 100644 --- a/fs/io_uring.c +++ b/fs/io_uring.c | |||
| @@ -2400,7 +2400,6 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events, | |||
| 2400 | const sigset_t __user *sig, size_t sigsz) | 2400 | const sigset_t __user *sig, size_t sigsz) |
| 2401 | { | 2401 | { |
| 2402 | struct io_cq_ring *ring = ctx->cq_ring; | 2402 | struct io_cq_ring *ring = ctx->cq_ring; |
| 2403 | sigset_t ksigmask, sigsaved; | ||
| 2404 | int ret; | 2403 | int ret; |
| 2405 | 2404 | ||
| 2406 | if (io_cqring_events(ring) >= min_events) | 2405 | if (io_cqring_events(ring) >= min_events) |
| @@ -2410,21 +2409,17 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events, | |||
| 2410 | #ifdef CONFIG_COMPAT | 2409 | #ifdef CONFIG_COMPAT |
| 2411 | if (in_compat_syscall()) | 2410 | if (in_compat_syscall()) |
| 2412 | ret = set_compat_user_sigmask((const compat_sigset_t __user *)sig, | 2411 | ret = set_compat_user_sigmask((const compat_sigset_t __user *)sig, |
| 2413 | &ksigmask, &sigsaved, sigsz); | 2412 | sigsz); |
| 2414 | else | 2413 | else |
| 2415 | #endif | 2414 | #endif |
| 2416 | ret = set_user_sigmask(sig, &ksigmask, | 2415 | ret = set_user_sigmask(sig, sigsz); |
| 2417 | &sigsaved, sigsz); | ||
| 2418 | 2416 | ||
| 2419 | if (ret) | 2417 | if (ret) |
| 2420 | return ret; | 2418 | return ret; |
| 2421 | } | 2419 | } |
| 2422 | 2420 | ||
| 2423 | ret = wait_event_interruptible(ctx->wait, io_cqring_events(ring) >= min_events); | 2421 | ret = wait_event_interruptible(ctx->wait, io_cqring_events(ring) >= min_events); |
| 2424 | 2422 | restore_saved_sigmask_unless(ret == -ERESTARTSYS); | |
| 2425 | if (sig) | ||
| 2426 | restore_user_sigmask(sig, &sigsaved, ret == -ERESTARTSYS); | ||
| 2427 | |||
| 2428 | if (ret == -ERESTARTSYS) | 2423 | if (ret == -ERESTARTSYS) |
| 2429 | ret = -EINTR; | 2424 | ret = -EINTR; |
| 2430 | 2425 | ||
diff --git a/fs/proc/Kconfig b/fs/proc/Kconfig index 47d2651fd9dc..cb5629bd5fff 100644 --- a/fs/proc/Kconfig +++ b/fs/proc/Kconfig | |||
| @@ -58,7 +58,8 @@ config PROC_VMCORE_DEVICE_DUMP | |||
| 58 | snapshot. | 58 | snapshot. |
| 59 | 59 | ||
| 60 | If you say Y here, the collected device dumps will be added | 60 | If you say Y here, the collected device dumps will be added |
| 61 | as ELF notes to /proc/vmcore. | 61 | as ELF notes to /proc/vmcore. You can still disable device |
| 62 | dump using the kernel command line option 'novmcoredd'. | ||
| 62 | 63 | ||
| 63 | config PROC_SYSCTL | 64 | config PROC_SYSCTL |
| 64 | bool "Sysctl support (/proc/sys)" if EXPERT | 65 | bool "Sysctl support (/proc/sys)" if EXPERT |
diff --git a/fs/proc/inode.c b/fs/proc/inode.c index 5f8d215b3fd0..dbe43a50caf2 100644 --- a/fs/proc/inode.c +++ b/fs/proc/inode.c | |||
| @@ -200,7 +200,8 @@ static loff_t proc_reg_llseek(struct file *file, loff_t offset, int whence) | |||
| 200 | struct proc_dir_entry *pde = PDE(file_inode(file)); | 200 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
| 201 | loff_t rv = -EINVAL; | 201 | loff_t rv = -EINVAL; |
| 202 | if (use_pde(pde)) { | 202 | if (use_pde(pde)) { |
| 203 | loff_t (*llseek)(struct file *, loff_t, int); | 203 | typeof_member(struct file_operations, llseek) llseek; |
| 204 | |||
| 204 | llseek = pde->proc_fops->llseek; | 205 | llseek = pde->proc_fops->llseek; |
| 205 | if (!llseek) | 206 | if (!llseek) |
| 206 | llseek = default_llseek; | 207 | llseek = default_llseek; |
| @@ -212,10 +213,11 @@ static loff_t proc_reg_llseek(struct file *file, loff_t offset, int whence) | |||
| 212 | 213 | ||
| 213 | static ssize_t proc_reg_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) | 214 | static ssize_t proc_reg_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) |
| 214 | { | 215 | { |
| 215 | ssize_t (*read)(struct file *, char __user *, size_t, loff_t *); | ||
| 216 | struct proc_dir_entry *pde = PDE(file_inode(file)); | 216 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
| 217 | ssize_t rv = -EIO; | 217 | ssize_t rv = -EIO; |
| 218 | if (use_pde(pde)) { | 218 | if (use_pde(pde)) { |
| 219 | typeof_member(struct file_operations, read) read; | ||
| 220 | |||
| 219 | read = pde->proc_fops->read; | 221 | read = pde->proc_fops->read; |
| 220 | if (read) | 222 | if (read) |
| 221 | rv = read(file, buf, count, ppos); | 223 | rv = read(file, buf, count, ppos); |
| @@ -226,10 +228,11 @@ static ssize_t proc_reg_read(struct file *file, char __user *buf, size_t count, | |||
| 226 | 228 | ||
| 227 | static ssize_t proc_reg_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) | 229 | static ssize_t proc_reg_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) |
| 228 | { | 230 | { |
| 229 | ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *); | ||
| 230 | struct proc_dir_entry *pde = PDE(file_inode(file)); | 231 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
| 231 | ssize_t rv = -EIO; | 232 | ssize_t rv = -EIO; |
| 232 | if (use_pde(pde)) { | 233 | if (use_pde(pde)) { |
| 234 | typeof_member(struct file_operations, write) write; | ||
| 235 | |||
| 233 | write = pde->proc_fops->write; | 236 | write = pde->proc_fops->write; |
| 234 | if (write) | 237 | if (write) |
| 235 | rv = write(file, buf, count, ppos); | 238 | rv = write(file, buf, count, ppos); |
| @@ -242,8 +245,9 @@ static __poll_t proc_reg_poll(struct file *file, struct poll_table_struct *pts) | |||
| 242 | { | 245 | { |
| 243 | struct proc_dir_entry *pde = PDE(file_inode(file)); | 246 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
| 244 | __poll_t rv = DEFAULT_POLLMASK; | 247 | __poll_t rv = DEFAULT_POLLMASK; |
| 245 | __poll_t (*poll)(struct file *, struct poll_table_struct *); | ||
| 246 | if (use_pde(pde)) { | 248 | if (use_pde(pde)) { |
| 249 | typeof_member(struct file_operations, poll) poll; | ||
| 250 | |||
| 247 | poll = pde->proc_fops->poll; | 251 | poll = pde->proc_fops->poll; |
| 248 | if (poll) | 252 | if (poll) |
| 249 | rv = poll(file, pts); | 253 | rv = poll(file, pts); |
| @@ -256,8 +260,9 @@ static long proc_reg_unlocked_ioctl(struct file *file, unsigned int cmd, unsigne | |||
| 256 | { | 260 | { |
| 257 | struct proc_dir_entry *pde = PDE(file_inode(file)); | 261 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
| 258 | long rv = -ENOTTY; | 262 | long rv = -ENOTTY; |
| 259 | long (*ioctl)(struct file *, unsigned int, unsigned long); | ||
| 260 | if (use_pde(pde)) { | 263 | if (use_pde(pde)) { |
| 264 | typeof_member(struct file_operations, unlocked_ioctl) ioctl; | ||
| 265 | |||
| 261 | ioctl = pde->proc_fops->unlocked_ioctl; | 266 | ioctl = pde->proc_fops->unlocked_ioctl; |
| 262 | if (ioctl) | 267 | if (ioctl) |
| 263 | rv = ioctl(file, cmd, arg); | 268 | rv = ioctl(file, cmd, arg); |
| @@ -271,8 +276,9 @@ static long proc_reg_compat_ioctl(struct file *file, unsigned int cmd, unsigned | |||
| 271 | { | 276 | { |
| 272 | struct proc_dir_entry *pde = PDE(file_inode(file)); | 277 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
| 273 | long rv = -ENOTTY; | 278 | long rv = -ENOTTY; |
| 274 | long (*compat_ioctl)(struct file *, unsigned int, unsigned long); | ||
| 275 | if (use_pde(pde)) { | 279 | if (use_pde(pde)) { |
| 280 | typeof_member(struct file_operations, compat_ioctl) compat_ioctl; | ||
| 281 | |||
| 276 | compat_ioctl = pde->proc_fops->compat_ioctl; | 282 | compat_ioctl = pde->proc_fops->compat_ioctl; |
| 277 | if (compat_ioctl) | 283 | if (compat_ioctl) |
| 278 | rv = compat_ioctl(file, cmd, arg); | 284 | rv = compat_ioctl(file, cmd, arg); |
| @@ -286,8 +292,9 @@ static int proc_reg_mmap(struct file *file, struct vm_area_struct *vma) | |||
| 286 | { | 292 | { |
| 287 | struct proc_dir_entry *pde = PDE(file_inode(file)); | 293 | struct proc_dir_entry *pde = PDE(file_inode(file)); |
| 288 | int rv = -EIO; | 294 | int rv = -EIO; |
| 289 | int (*mmap)(struct file *, struct vm_area_struct *); | ||
| 290 | if (use_pde(pde)) { | 295 | if (use_pde(pde)) { |
| 296 | typeof_member(struct file_operations, mmap) mmap; | ||
| 297 | |||
| 291 | mmap = pde->proc_fops->mmap; | 298 | mmap = pde->proc_fops->mmap; |
| 292 | if (mmap) | 299 | if (mmap) |
| 293 | rv = mmap(file, vma); | 300 | rv = mmap(file, vma); |
| @@ -305,7 +312,7 @@ proc_reg_get_unmapped_area(struct file *file, unsigned long orig_addr, | |||
| 305 | unsigned long rv = -EIO; | 312 | unsigned long rv = -EIO; |
| 306 | 313 | ||
| 307 | if (use_pde(pde)) { | 314 | if (use_pde(pde)) { |
| 308 | typeof(proc_reg_get_unmapped_area) *get_area; | 315 | typeof_member(struct file_operations, get_unmapped_area) get_area; |
| 309 | 316 | ||
| 310 | get_area = pde->proc_fops->get_unmapped_area; | 317 | get_area = pde->proc_fops->get_unmapped_area; |
| 311 | #ifdef CONFIG_MMU | 318 | #ifdef CONFIG_MMU |
| @@ -326,8 +333,8 @@ static int proc_reg_open(struct inode *inode, struct file *file) | |||
| 326 | { | 333 | { |
| 327 | struct proc_dir_entry *pde = PDE(inode); | 334 | struct proc_dir_entry *pde = PDE(inode); |
| 328 | int rv = 0; | 335 | int rv = 0; |
| 329 | int (*open)(struct inode *, struct file *); | 336 | typeof_member(struct file_operations, open) open; |
| 330 | int (*release)(struct inode *, struct file *); | 337 | typeof_member(struct file_operations, release) release; |
| 331 | struct pde_opener *pdeo; | 338 | struct pde_opener *pdeo; |
| 332 | 339 | ||
| 333 | /* | 340 | /* |
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index c74570736b24..36ad1b0d6259 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c | |||
| @@ -499,6 +499,10 @@ static struct inode *proc_sys_make_inode(struct super_block *sb, | |||
| 499 | 499 | ||
| 500 | if (root->set_ownership) | 500 | if (root->set_ownership) |
| 501 | root->set_ownership(head, table, &inode->i_uid, &inode->i_gid); | 501 | root->set_ownership(head, table, &inode->i_uid, &inode->i_gid); |
| 502 | else { | ||
| 503 | inode->i_uid = GLOBAL_ROOT_UID; | ||
| 504 | inode->i_gid = GLOBAL_ROOT_GID; | ||
| 505 | } | ||
| 502 | 506 | ||
| 503 | return inode; | 507 | return inode; |
| 504 | } | 508 | } |
diff --git a/fs/proc/vmcore.c b/fs/proc/vmcore.c index 57957c91c6df..7bcc92add72c 100644 --- a/fs/proc/vmcore.c +++ b/fs/proc/vmcore.c | |||
| @@ -21,6 +21,7 @@ | |||
| 21 | #include <linux/init.h> | 21 | #include <linux/init.h> |
| 22 | #include <linux/crash_dump.h> | 22 | #include <linux/crash_dump.h> |
| 23 | #include <linux/list.h> | 23 | #include <linux/list.h> |
| 24 | #include <linux/moduleparam.h> | ||
| 24 | #include <linux/mutex.h> | 25 | #include <linux/mutex.h> |
| 25 | #include <linux/vmalloc.h> | 26 | #include <linux/vmalloc.h> |
| 26 | #include <linux/pagemap.h> | 27 | #include <linux/pagemap.h> |
| @@ -54,6 +55,9 @@ static struct proc_dir_entry *proc_vmcore; | |||
| 54 | /* Device Dump list and mutex to synchronize access to list */ | 55 | /* Device Dump list and mutex to synchronize access to list */ |
| 55 | static LIST_HEAD(vmcoredd_list); | 56 | static LIST_HEAD(vmcoredd_list); |
| 56 | static DEFINE_MUTEX(vmcoredd_mutex); | 57 | static DEFINE_MUTEX(vmcoredd_mutex); |
| 58 | |||
| 59 | static bool vmcoredd_disabled; | ||
| 60 | core_param(novmcoredd, vmcoredd_disabled, bool, 0); | ||
| 57 | #endif /* CONFIG_PROC_VMCORE_DEVICE_DUMP */ | 61 | #endif /* CONFIG_PROC_VMCORE_DEVICE_DUMP */ |
| 58 | 62 | ||
| 59 | /* Device Dump Size */ | 63 | /* Device Dump Size */ |
| @@ -1452,6 +1456,11 @@ int vmcore_add_device_dump(struct vmcoredd_data *data) | |||
| 1452 | size_t data_size; | 1456 | size_t data_size; |
| 1453 | int ret; | 1457 | int ret; |
| 1454 | 1458 | ||
| 1459 | if (vmcoredd_disabled) { | ||
| 1460 | pr_err_once("Device dump is disabled\n"); | ||
| 1461 | return -EINVAL; | ||
| 1462 | } | ||
| 1463 | |||
| 1455 | if (!data || !strlen(data->dump_name) || | 1464 | if (!data || !strlen(data->dump_name) || |
| 1456 | !data->vmcoredd_callback || !data->size) | 1465 | !data->vmcoredd_callback || !data->size) |
| 1457 | return -EINVAL; | 1466 | return -EINVAL; |
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index 36346dc4cec0..4517a1394c6f 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c | |||
| @@ -94,7 +94,7 @@ static int journal_join(struct reiserfs_transaction_handle *th, | |||
| 94 | struct super_block *sb); | 94 | struct super_block *sb); |
| 95 | static void release_journal_dev(struct super_block *super, | 95 | static void release_journal_dev(struct super_block *super, |
| 96 | struct reiserfs_journal *journal); | 96 | struct reiserfs_journal *journal); |
| 97 | static int dirty_one_transaction(struct super_block *s, | 97 | static void dirty_one_transaction(struct super_block *s, |
| 98 | struct reiserfs_journal_list *jl); | 98 | struct reiserfs_journal_list *jl); |
| 99 | static void flush_async_commits(struct work_struct *work); | 99 | static void flush_async_commits(struct work_struct *work); |
| 100 | static void queue_log_writer(struct super_block *s); | 100 | static void queue_log_writer(struct super_block *s); |
| @@ -1682,12 +1682,11 @@ next: | |||
| 1682 | } | 1682 | } |
| 1683 | 1683 | ||
| 1684 | /* used by flush_commit_list */ | 1684 | /* used by flush_commit_list */ |
| 1685 | static int dirty_one_transaction(struct super_block *s, | 1685 | static void dirty_one_transaction(struct super_block *s, |
| 1686 | struct reiserfs_journal_list *jl) | 1686 | struct reiserfs_journal_list *jl) |
| 1687 | { | 1687 | { |
| 1688 | struct reiserfs_journal_cnode *cn; | 1688 | struct reiserfs_journal_cnode *cn; |
| 1689 | struct reiserfs_journal_list *pjl; | 1689 | struct reiserfs_journal_list *pjl; |
| 1690 | int ret = 0; | ||
| 1691 | 1690 | ||
| 1692 | jl->j_state |= LIST_DIRTY; | 1691 | jl->j_state |= LIST_DIRTY; |
| 1693 | cn = jl->j_realblock; | 1692 | cn = jl->j_realblock; |
| @@ -1716,7 +1715,6 @@ static int dirty_one_transaction(struct super_block *s, | |||
| 1716 | } | 1715 | } |
| 1717 | cn = cn->next; | 1716 | cn = cn->next; |
| 1718 | } | 1717 | } |
| 1719 | return ret; | ||
| 1720 | } | 1718 | } |
| 1721 | 1719 | ||
| 1722 | static int kupdate_transactions(struct super_block *s, | 1720 | static int kupdate_transactions(struct super_block *s, |
diff --git a/fs/select.c b/fs/select.c index a4d8f6e8b63c..53a0c149f528 100644 --- a/fs/select.c +++ b/fs/select.c | |||
| @@ -294,12 +294,14 @@ enum poll_time_type { | |||
| 294 | PT_OLD_TIMESPEC = 3, | 294 | PT_OLD_TIMESPEC = 3, |
| 295 | }; | 295 | }; |
| 296 | 296 | ||
| 297 | static int poll_select_copy_remaining(struct timespec64 *end_time, | 297 | static int poll_select_finish(struct timespec64 *end_time, |
| 298 | void __user *p, | 298 | void __user *p, |
| 299 | enum poll_time_type pt_type, int ret) | 299 | enum poll_time_type pt_type, int ret) |
| 300 | { | 300 | { |
| 301 | struct timespec64 rts; | 301 | struct timespec64 rts; |
| 302 | 302 | ||
| 303 | restore_saved_sigmask_unless(ret == -ERESTARTNOHAND); | ||
| 304 | |||
| 303 | if (!p) | 305 | if (!p) |
| 304 | return ret; | 306 | return ret; |
| 305 | 307 | ||
| @@ -714,9 +716,7 @@ static int kern_select(int n, fd_set __user *inp, fd_set __user *outp, | |||
| 714 | } | 716 | } |
| 715 | 717 | ||
| 716 | ret = core_sys_select(n, inp, outp, exp, to); | 718 | ret = core_sys_select(n, inp, outp, exp, to); |
| 717 | ret = poll_select_copy_remaining(&end_time, tvp, PT_TIMEVAL, ret); | 719 | return poll_select_finish(&end_time, tvp, PT_TIMEVAL, ret); |
| 718 | |||
| 719 | return ret; | ||
| 720 | } | 720 | } |
| 721 | 721 | ||
| 722 | SYSCALL_DEFINE5(select, int, n, fd_set __user *, inp, fd_set __user *, outp, | 722 | SYSCALL_DEFINE5(select, int, n, fd_set __user *, inp, fd_set __user *, outp, |
| @@ -730,7 +730,6 @@ static long do_pselect(int n, fd_set __user *inp, fd_set __user *outp, | |||
| 730 | const sigset_t __user *sigmask, size_t sigsetsize, | 730 | const sigset_t __user *sigmask, size_t sigsetsize, |
| 731 | enum poll_time_type type) | 731 | enum poll_time_type type) |
| 732 | { | 732 | { |
| 733 | sigset_t ksigmask, sigsaved; | ||
| 734 | struct timespec64 ts, end_time, *to = NULL; | 733 | struct timespec64 ts, end_time, *to = NULL; |
| 735 | int ret; | 734 | int ret; |
| 736 | 735 | ||
| @@ -753,15 +752,12 @@ static long do_pselect(int n, fd_set __user *inp, fd_set __user *outp, | |||
| 753 | return -EINVAL; | 752 | return -EINVAL; |
| 754 | } | 753 | } |
| 755 | 754 | ||
| 756 | ret = set_user_sigmask(sigmask, &ksigmask, &sigsaved, sigsetsize); | 755 | ret = set_user_sigmask(sigmask, sigsetsize); |
| 757 | if (ret) | 756 | if (ret) |
| 758 | return ret; | 757 | return ret; |
| 759 | 758 | ||
| 760 | ret = core_sys_select(n, inp, outp, exp, to); | 759 | ret = core_sys_select(n, inp, outp, exp, to); |
| 761 | restore_user_sigmask(sigmask, &sigsaved, ret == -ERESTARTNOHAND); | 760 | return poll_select_finish(&end_time, tsp, type, ret); |
| 762 | ret = poll_select_copy_remaining(&end_time, tsp, type, ret); | ||
| 763 | |||
| 764 | return ret; | ||
| 765 | } | 761 | } |
| 766 | 762 | ||
| 767 | /* | 763 | /* |
| @@ -926,7 +922,7 @@ static int do_poll(struct poll_list *list, struct poll_wqueues *wait, | |||
| 926 | if (!count) { | 922 | if (!count) { |
| 927 | count = wait->error; | 923 | count = wait->error; |
| 928 | if (signal_pending(current)) | 924 | if (signal_pending(current)) |
| 929 | count = -EINTR; | 925 | count = -ERESTARTNOHAND; |
| 930 | } | 926 | } |
| 931 | if (count || timed_out) | 927 | if (count || timed_out) |
| 932 | break; | 928 | break; |
| @@ -965,7 +961,7 @@ static int do_sys_poll(struct pollfd __user *ufds, unsigned int nfds, | |||
| 965 | struct timespec64 *end_time) | 961 | struct timespec64 *end_time) |
| 966 | { | 962 | { |
| 967 | struct poll_wqueues table; | 963 | struct poll_wqueues table; |
| 968 | int err = -EFAULT, fdcount, len, size; | 964 | int err = -EFAULT, fdcount, len; |
| 969 | /* Allocate small arguments on the stack to save memory and be | 965 | /* Allocate small arguments on the stack to save memory and be |
| 970 | faster - use long to make sure the buffer is aligned properly | 966 | faster - use long to make sure the buffer is aligned properly |
| 971 | on 64 bit archs to avoid unaligned access */ | 967 | on 64 bit archs to avoid unaligned access */ |
| @@ -993,8 +989,8 @@ static int do_sys_poll(struct pollfd __user *ufds, unsigned int nfds, | |||
| 993 | break; | 989 | break; |
| 994 | 990 | ||
| 995 | len = min(todo, POLLFD_PER_PAGE); | 991 | len = min(todo, POLLFD_PER_PAGE); |
| 996 | size = sizeof(struct poll_list) + sizeof(struct pollfd) * len; | 992 | walk = walk->next = kmalloc(struct_size(walk, entries, len), |
| 997 | walk = walk->next = kmalloc(size, GFP_KERNEL); | 993 | GFP_KERNEL); |
| 998 | if (!walk) { | 994 | if (!walk) { |
| 999 | err = -ENOMEM; | 995 | err = -ENOMEM; |
| 1000 | goto out_fds; | 996 | goto out_fds; |
| @@ -1041,7 +1037,7 @@ static long do_restart_poll(struct restart_block *restart_block) | |||
| 1041 | 1037 | ||
| 1042 | ret = do_sys_poll(ufds, nfds, to); | 1038 | ret = do_sys_poll(ufds, nfds, to); |
| 1043 | 1039 | ||
| 1044 | if (ret == -EINTR) { | 1040 | if (ret == -ERESTARTNOHAND) { |
| 1045 | restart_block->fn = do_restart_poll; | 1041 | restart_block->fn = do_restart_poll; |
| 1046 | ret = -ERESTART_RESTARTBLOCK; | 1042 | ret = -ERESTART_RESTARTBLOCK; |
| 1047 | } | 1043 | } |
| @@ -1062,7 +1058,7 @@ SYSCALL_DEFINE3(poll, struct pollfd __user *, ufds, unsigned int, nfds, | |||
| 1062 | 1058 | ||
| 1063 | ret = do_sys_poll(ufds, nfds, to); | 1059 | ret = do_sys_poll(ufds, nfds, to); |
| 1064 | 1060 | ||
| 1065 | if (ret == -EINTR) { | 1061 | if (ret == -ERESTARTNOHAND) { |
| 1066 | struct restart_block *restart_block; | 1062 | struct restart_block *restart_block; |
| 1067 | 1063 | ||
| 1068 | restart_block = ¤t->restart_block; | 1064 | restart_block = ¤t->restart_block; |
| @@ -1086,7 +1082,6 @@ SYSCALL_DEFINE5(ppoll, struct pollfd __user *, ufds, unsigned int, nfds, | |||
| 1086 | struct __kernel_timespec __user *, tsp, const sigset_t __user *, sigmask, | 1082 | struct __kernel_timespec __user *, tsp, const sigset_t __user *, sigmask, |
| 1087 | size_t, sigsetsize) | 1083 | size_t, sigsetsize) |
| 1088 | { | 1084 | { |
| 1089 | sigset_t ksigmask, sigsaved; | ||
| 1090 | struct timespec64 ts, end_time, *to = NULL; | 1085 | struct timespec64 ts, end_time, *to = NULL; |
| 1091 | int ret; | 1086 | int ret; |
| 1092 | 1087 | ||
| @@ -1099,20 +1094,12 @@ SYSCALL_DEFINE5(ppoll, struct pollfd __user *, ufds, unsigned int, nfds, | |||
| 1099 | return -EINVAL; | 1094 | return -EINVAL; |
| 1100 | } | 1095 | } |
| 1101 | 1096 | ||
| 1102 | ret = set_user_sigmask(sigmask, &ksigmask, &sigsaved, sigsetsize); | 1097 | ret = set_user_sigmask(sigmask, sigsetsize); |
| 1103 | if (ret) | 1098 | if (ret) |
| 1104 | return ret; | 1099 | return ret; |
| 1105 | 1100 | ||
| 1106 | ret = do_sys_poll(ufds, nfds, to); | 1101 | ret = do_sys_poll(ufds, nfds, to); |
| 1107 | 1102 | return poll_select_finish(&end_time, tsp, PT_TIMESPEC, ret); | |
| 1108 | restore_user_sigmask(sigmask, &sigsaved, ret == -EINTR); | ||
| 1109 | /* We can restart this syscall, usually */ | ||
| 1110 | if (ret == -EINTR) | ||
| 1111 | ret = -ERESTARTNOHAND; | ||
| 1112 | |||
| 1113 | ret = poll_select_copy_remaining(&end_time, tsp, PT_TIMESPEC, ret); | ||
| 1114 | |||
| 1115 | return ret; | ||
| 1116 | } | 1103 | } |
| 1117 | 1104 | ||
| 1118 | #if defined(CONFIG_COMPAT_32BIT_TIME) && !defined(CONFIG_64BIT) | 1105 | #if defined(CONFIG_COMPAT_32BIT_TIME) && !defined(CONFIG_64BIT) |
| @@ -1121,7 +1108,6 @@ SYSCALL_DEFINE5(ppoll_time32, struct pollfd __user *, ufds, unsigned int, nfds, | |||
| 1121 | struct old_timespec32 __user *, tsp, const sigset_t __user *, sigmask, | 1108 | struct old_timespec32 __user *, tsp, const sigset_t __user *, sigmask, |
| 1122 | size_t, sigsetsize) | 1109 | size_t, sigsetsize) |
| 1123 | { | 1110 | { |
| 1124 | sigset_t ksigmask, sigsaved; | ||
| 1125 | struct timespec64 ts, end_time, *to = NULL; | 1111 | struct timespec64 ts, end_time, *to = NULL; |
| 1126 | int ret; | 1112 | int ret; |
| 1127 | 1113 | ||
| @@ -1134,20 +1120,12 @@ SYSCALL_DEFINE5(ppoll_time32, struct pollfd __user *, ufds, unsigned int, nfds, | |||
| 1134 | return -EINVAL; | 1120 | return -EINVAL; |
| 1135 | } | 1121 | } |
| 1136 | 1122 | ||
| 1137 | ret = set_user_sigmask(sigmask, &ksigmask, &sigsaved, sigsetsize); | 1123 | ret = set_user_sigmask(sigmask, sigsetsize); |
| 1138 | if (ret) | 1124 | if (ret) |
| 1139 | return ret; | 1125 | return ret; |
| 1140 | 1126 | ||
| 1141 | ret = do_sys_poll(ufds, nfds, to); | 1127 | ret = do_sys_poll(ufds, nfds, to); |
| 1142 | 1128 | return poll_select_finish(&end_time, tsp, PT_OLD_TIMESPEC, ret); | |
| 1143 | restore_user_sigmask(sigmask, &sigsaved, ret == -EINTR); | ||
| 1144 | /* We can restart this syscall, usually */ | ||
| 1145 | if (ret == -EINTR) | ||
| 1146 | ret = -ERESTARTNOHAND; | ||
| 1147 | |||
| 1148 | ret = poll_select_copy_remaining(&end_time, tsp, PT_OLD_TIMESPEC, ret); | ||
| 1149 | |||
| 1150 | return ret; | ||
| 1151 | } | 1129 | } |
| 1152 | #endif | 1130 | #endif |
| 1153 | 1131 | ||
| @@ -1284,9 +1262,7 @@ static int do_compat_select(int n, compat_ulong_t __user *inp, | |||
| 1284 | } | 1262 | } |
| 1285 | 1263 | ||
| 1286 | ret = compat_core_sys_select(n, inp, outp, exp, to); | 1264 | ret = compat_core_sys_select(n, inp, outp, exp, to); |
| 1287 | ret = poll_select_copy_remaining(&end_time, tvp, PT_OLD_TIMEVAL, ret); | 1265 | return poll_select_finish(&end_time, tvp, PT_OLD_TIMEVAL, ret); |
| 1288 | |||
| 1289 | return ret; | ||
| 1290 | } | 1266 | } |
| 1291 | 1267 | ||
| 1292 | COMPAT_SYSCALL_DEFINE5(select, int, n, compat_ulong_t __user *, inp, | 1268 | COMPAT_SYSCALL_DEFINE5(select, int, n, compat_ulong_t __user *, inp, |
| @@ -1319,7 +1295,6 @@ static long do_compat_pselect(int n, compat_ulong_t __user *inp, | |||
| 1319 | void __user *tsp, compat_sigset_t __user *sigmask, | 1295 | void __user *tsp, compat_sigset_t __user *sigmask, |
| 1320 | compat_size_t sigsetsize, enum poll_time_type type) | 1296 | compat_size_t sigsetsize, enum poll_time_type type) |
| 1321 | { | 1297 | { |
| 1322 | sigset_t ksigmask, sigsaved; | ||
| 1323 | struct timespec64 ts, end_time, *to = NULL; | 1298 | struct timespec64 ts, end_time, *to = NULL; |
| 1324 | int ret; | 1299 | int ret; |
| 1325 | 1300 | ||
| @@ -1342,15 +1317,12 @@ static long do_compat_pselect(int n, compat_ulong_t __user *inp, | |||
| 1342 | return -EINVAL; | 1317 | return -EINVAL; |
| 1343 | } | 1318 | } |
| 1344 | 1319 | ||
| 1345 | ret = set_compat_user_sigmask(sigmask, &ksigmask, &sigsaved, sigsetsize); | 1320 | ret = set_compat_user_sigmask(sigmask, sigsetsize); |
| 1346 | if (ret) | 1321 | if (ret) |
| 1347 | return ret; | 1322 | return ret; |
| 1348 | 1323 | ||
| 1349 | ret = compat_core_sys_select(n, inp, outp, exp, to); | 1324 | ret = compat_core_sys_select(n, inp, outp, exp, to); |
| 1350 | restore_user_sigmask(sigmask, &sigsaved, ret == -ERESTARTNOHAND); | 1325 | return poll_select_finish(&end_time, tsp, type, ret); |
| 1351 | ret = poll_select_copy_remaining(&end_time, tsp, type, ret); | ||
| 1352 | |||
| 1353 | return ret; | ||
| 1354 | } | 1326 | } |
| 1355 | 1327 | ||
| 1356 | COMPAT_SYSCALL_DEFINE6(pselect6_time64, int, n, compat_ulong_t __user *, inp, | 1328 | COMPAT_SYSCALL_DEFINE6(pselect6_time64, int, n, compat_ulong_t __user *, inp, |
| @@ -1402,7 +1374,6 @@ COMPAT_SYSCALL_DEFINE5(ppoll_time32, struct pollfd __user *, ufds, | |||
| 1402 | unsigned int, nfds, struct old_timespec32 __user *, tsp, | 1374 | unsigned int, nfds, struct old_timespec32 __user *, tsp, |
| 1403 | const compat_sigset_t __user *, sigmask, compat_size_t, sigsetsize) | 1375 | const compat_sigset_t __user *, sigmask, compat_size_t, sigsetsize) |
| 1404 | { | 1376 | { |
| 1405 | sigset_t ksigmask, sigsaved; | ||
| 1406 | struct timespec64 ts, end_time, *to = NULL; | 1377 | struct timespec64 ts, end_time, *to = NULL; |
| 1407 | int ret; | 1378 | int ret; |
| 1408 | 1379 | ||
| @@ -1415,20 +1386,12 @@ COMPAT_SYSCALL_DEFINE5(ppoll_time32, struct pollfd __user *, ufds, | |||
| 1415 | return -EINVAL; | 1386 | return -EINVAL; |
| 1416 | } | 1387 | } |
| 1417 | 1388 | ||
| 1418 | ret = set_compat_user_sigmask(sigmask, &ksigmask, &sigsaved, sigsetsize); | 1389 | ret = set_compat_user_sigmask(sigmask, sigsetsize); |
| 1419 | if (ret) | 1390 | if (ret) |
| 1420 | return ret; | 1391 | return ret; |
| 1421 | 1392 | ||
| 1422 | ret = do_sys_poll(ufds, nfds, to); | 1393 | ret = do_sys_poll(ufds, nfds, to); |
| 1423 | 1394 | return poll_select_finish(&end_time, tsp, PT_OLD_TIMESPEC, ret); | |
| 1424 | restore_user_sigmask(sigmask, &sigsaved, ret == -EINTR); | ||
| 1425 | /* We can restart this syscall, usually */ | ||
| 1426 | if (ret == -EINTR) | ||
| 1427 | ret = -ERESTARTNOHAND; | ||
| 1428 | |||
| 1429 | ret = poll_select_copy_remaining(&end_time, tsp, PT_OLD_TIMESPEC, ret); | ||
| 1430 | |||
| 1431 | return ret; | ||
| 1432 | } | 1395 | } |
| 1433 | #endif | 1396 | #endif |
| 1434 | 1397 | ||
| @@ -1437,7 +1400,6 @@ COMPAT_SYSCALL_DEFINE5(ppoll_time64, struct pollfd __user *, ufds, | |||
| 1437 | unsigned int, nfds, struct __kernel_timespec __user *, tsp, | 1400 | unsigned int, nfds, struct __kernel_timespec __user *, tsp, |
| 1438 | const compat_sigset_t __user *, sigmask, compat_size_t, sigsetsize) | 1401 | const compat_sigset_t __user *, sigmask, compat_size_t, sigsetsize) |
| 1439 | { | 1402 | { |
| 1440 | sigset_t ksigmask, sigsaved; | ||
| 1441 | struct timespec64 ts, end_time, *to = NULL; | 1403 | struct timespec64 ts, end_time, *to = NULL; |
| 1442 | int ret; | 1404 | int ret; |
| 1443 | 1405 | ||
| @@ -1450,20 +1412,12 @@ COMPAT_SYSCALL_DEFINE5(ppoll_time64, struct pollfd __user *, ufds, | |||
| 1450 | return -EINVAL; | 1412 | return -EINVAL; |
| 1451 | } | 1413 | } |
| 1452 | 1414 | ||
| 1453 | ret = set_compat_user_sigmask(sigmask, &ksigmask, &sigsaved, sigsetsize); | 1415 | ret = set_compat_user_sigmask(sigmask, sigsetsize); |
| 1454 | if (ret) | 1416 | if (ret) |
| 1455 | return ret; | 1417 | return ret; |
| 1456 | 1418 | ||
| 1457 | ret = do_sys_poll(ufds, nfds, to); | 1419 | ret = do_sys_poll(ufds, nfds, to); |
| 1458 | 1420 | return poll_select_finish(&end_time, tsp, PT_TIMESPEC, ret); | |
| 1459 | restore_user_sigmask(sigmask, &sigsaved, ret == -EINTR); | ||
| 1460 | /* We can restart this syscall, usually */ | ||
| 1461 | if (ret == -EINTR) | ||
| 1462 | ret = -ERESTARTNOHAND; | ||
| 1463 | |||
| 1464 | ret = poll_select_copy_remaining(&end_time, tsp, PT_TIMESPEC, ret); | ||
| 1465 | |||
| 1466 | return ret; | ||
| 1467 | } | 1421 | } |
| 1468 | 1422 | ||
| 1469 | #endif | 1423 | #endif |
diff --git a/fs/ufs/super.c b/fs/ufs/super.c index 3d247c0d92aa..4ed0dca52ec8 100644 --- a/fs/ufs/super.c +++ b/fs/ufs/super.c | |||
| @@ -1407,11 +1407,9 @@ static int ufs_statfs(struct dentry *dentry, struct kstatfs *buf) | |||
| 1407 | struct super_block *sb = dentry->d_sb; | 1407 | struct super_block *sb = dentry->d_sb; |
| 1408 | struct ufs_sb_private_info *uspi= UFS_SB(sb)->s_uspi; | 1408 | struct ufs_sb_private_info *uspi= UFS_SB(sb)->s_uspi; |
| 1409 | unsigned flags = UFS_SB(sb)->s_flags; | 1409 | unsigned flags = UFS_SB(sb)->s_flags; |
| 1410 | struct ufs_super_block_third *usb3; | ||
| 1411 | u64 id = huge_encode_dev(sb->s_bdev->bd_dev); | 1410 | u64 id = huge_encode_dev(sb->s_bdev->bd_dev); |
| 1412 | 1411 | ||
| 1413 | mutex_lock(&UFS_SB(sb)->s_lock); | 1412 | mutex_lock(&UFS_SB(sb)->s_lock); |
| 1414 | usb3 = ubh_get_usb_third(uspi); | ||
| 1415 | 1413 | ||
| 1416 | if ((flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2) | 1414 | if ((flags & UFS_TYPE_MASK) == UFS_TYPE_UFS2) |
| 1417 | buf->f_type = UFS2_MAGIC; | 1415 | buf->f_type = UFS2_MAGIC; |
