diff options
Diffstat (limited to 'fs')
44 files changed, 523 insertions, 149 deletions
diff --git a/fs/bad_inode.c b/fs/bad_inode.c index b1342ffb3cf6..922ad460bff9 100644 --- a/fs/bad_inode.c +++ b/fs/bad_inode.c | |||
@@ -16,7 +16,7 @@ | |||
16 | #include <linux/poll.h> | 16 | #include <linux/poll.h> |
17 | 17 | ||
18 | 18 | ||
19 | static loff_t bad_file_llseek(struct file *file, loff_t offset, int origin) | 19 | static loff_t bad_file_llseek(struct file *file, loff_t offset, int whence) |
20 | { | 20 | { |
21 | return -EIO; | 21 | return -EIO; |
22 | } | 22 | } |
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index 6d7d1647a68c..0c42cdbabecf 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -1601,8 +1601,10 @@ static int fill_note_info(struct elfhdr *elf, int phdrs, | |||
1601 | info->thread = NULL; | 1601 | info->thread = NULL; |
1602 | 1602 | ||
1603 | psinfo = kmalloc(sizeof(*psinfo), GFP_KERNEL); | 1603 | psinfo = kmalloc(sizeof(*psinfo), GFP_KERNEL); |
1604 | if (psinfo == NULL) | 1604 | if (psinfo == NULL) { |
1605 | info->psinfo.data = NULL; /* So we don't free this wrongly */ | ||
1605 | return 0; | 1606 | return 0; |
1607 | } | ||
1606 | 1608 | ||
1607 | fill_note(&info->psinfo, "CORE", NT_PRPSINFO, sizeof(*psinfo), psinfo); | 1609 | fill_note(&info->psinfo, "CORE", NT_PRPSINFO, sizeof(*psinfo), psinfo); |
1608 | 1610 | ||
diff --git a/fs/binfmt_em86.c b/fs/binfmt_em86.c index 4e6cce57d113..037a3e2b045b 100644 --- a/fs/binfmt_em86.c +++ b/fs/binfmt_em86.c | |||
@@ -42,7 +42,6 @@ static int load_em86(struct linux_binprm *bprm) | |||
42 | return -ENOEXEC; | 42 | return -ENOEXEC; |
43 | } | 43 | } |
44 | 44 | ||
45 | bprm->recursion_depth++; /* Well, the bang-shell is implicit... */ | ||
46 | allow_write_access(bprm->file); | 45 | allow_write_access(bprm->file); |
47 | fput(bprm->file); | 46 | fput(bprm->file); |
48 | bprm->file = NULL; | 47 | bprm->file = NULL; |
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c index b0b70fbea06c..9be335fb8a7c 100644 --- a/fs/binfmt_misc.c +++ b/fs/binfmt_misc.c | |||
@@ -117,10 +117,6 @@ static int load_misc_binary(struct linux_binprm *bprm) | |||
117 | if (!enabled) | 117 | if (!enabled) |
118 | goto _ret; | 118 | goto _ret; |
119 | 119 | ||
120 | retval = -ENOEXEC; | ||
121 | if (bprm->recursion_depth > BINPRM_MAX_RECURSION) | ||
122 | goto _ret; | ||
123 | |||
124 | /* to keep locking time low, we copy the interpreter string */ | 120 | /* to keep locking time low, we copy the interpreter string */ |
125 | read_lock(&entries_lock); | 121 | read_lock(&entries_lock); |
126 | fmt = check_file(bprm); | 122 | fmt = check_file(bprm); |
@@ -197,8 +193,6 @@ static int load_misc_binary(struct linux_binprm *bprm) | |||
197 | if (retval < 0) | 193 | if (retval < 0) |
198 | goto _error; | 194 | goto _error; |
199 | 195 | ||
200 | bprm->recursion_depth++; | ||
201 | |||
202 | retval = search_binary_handler(bprm); | 196 | retval = search_binary_handler(bprm); |
203 | if (retval < 0) | 197 | if (retval < 0) |
204 | goto _error; | 198 | goto _error; |
diff --git a/fs/binfmt_script.c b/fs/binfmt_script.c index 8c954997e7f7..1610a91637e5 100644 --- a/fs/binfmt_script.c +++ b/fs/binfmt_script.c | |||
@@ -22,15 +22,13 @@ static int load_script(struct linux_binprm *bprm) | |||
22 | char interp[BINPRM_BUF_SIZE]; | 22 | char interp[BINPRM_BUF_SIZE]; |
23 | int retval; | 23 | int retval; |
24 | 24 | ||
25 | if ((bprm->buf[0] != '#') || (bprm->buf[1] != '!') || | 25 | if ((bprm->buf[0] != '#') || (bprm->buf[1] != '!')) |
26 | (bprm->recursion_depth > BINPRM_MAX_RECURSION)) | ||
27 | return -ENOEXEC; | 26 | return -ENOEXEC; |
28 | /* | 27 | /* |
29 | * This section does the #! interpretation. | 28 | * This section does the #! interpretation. |
30 | * Sorta complicated, but hopefully it will work. -TYT | 29 | * Sorta complicated, but hopefully it will work. -TYT |
31 | */ | 30 | */ |
32 | 31 | ||
33 | bprm->recursion_depth++; | ||
34 | allow_write_access(bprm->file); | 32 | allow_write_access(bprm->file); |
35 | fput(bprm->file); | 33 | fput(bprm->file); |
36 | bprm->file = NULL; | 34 | bprm->file = NULL; |
diff --git a/fs/block_dev.c b/fs/block_dev.c index ab3a456f6650..172f8491a2bd 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -321,7 +321,7 @@ static int blkdev_write_end(struct file *file, struct address_space *mapping, | |||
321 | * for a block special file file->f_path.dentry->d_inode->i_size is zero | 321 | * for a block special file file->f_path.dentry->d_inode->i_size is zero |
322 | * so we compute the size by hand (just as in block_read/write above) | 322 | * so we compute the size by hand (just as in block_read/write above) |
323 | */ | 323 | */ |
324 | static loff_t block_llseek(struct file *file, loff_t offset, int origin) | 324 | static loff_t block_llseek(struct file *file, loff_t offset, int whence) |
325 | { | 325 | { |
326 | struct inode *bd_inode = file->f_mapping->host; | 326 | struct inode *bd_inode = file->f_mapping->host; |
327 | loff_t size; | 327 | loff_t size; |
@@ -331,7 +331,7 @@ static loff_t block_llseek(struct file *file, loff_t offset, int origin) | |||
331 | size = i_size_read(bd_inode); | 331 | size = i_size_read(bd_inode); |
332 | 332 | ||
333 | retval = -EINVAL; | 333 | retval = -EINVAL; |
334 | switch (origin) { | 334 | switch (whence) { |
335 | case SEEK_END: | 335 | case SEEK_END: |
336 | offset += size; | 336 | offset += size; |
337 | break; | 337 | break; |
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index a8ee75cb96ee..9c6673a9231f 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -2120,7 +2120,7 @@ out: | |||
2120 | return ret; | 2120 | return ret; |
2121 | } | 2121 | } |
2122 | 2122 | ||
2123 | static int find_desired_extent(struct inode *inode, loff_t *offset, int origin) | 2123 | static int find_desired_extent(struct inode *inode, loff_t *offset, int whence) |
2124 | { | 2124 | { |
2125 | struct btrfs_root *root = BTRFS_I(inode)->root; | 2125 | struct btrfs_root *root = BTRFS_I(inode)->root; |
2126 | struct extent_map *em; | 2126 | struct extent_map *em; |
@@ -2154,7 +2154,7 @@ static int find_desired_extent(struct inode *inode, loff_t *offset, int origin) | |||
2154 | * before the position we want in case there is outstanding delalloc | 2154 | * before the position we want in case there is outstanding delalloc |
2155 | * going on here. | 2155 | * going on here. |
2156 | */ | 2156 | */ |
2157 | if (origin == SEEK_HOLE && start != 0) { | 2157 | if (whence == SEEK_HOLE && start != 0) { |
2158 | if (start <= root->sectorsize) | 2158 | if (start <= root->sectorsize) |
2159 | em = btrfs_get_extent_fiemap(inode, NULL, 0, 0, | 2159 | em = btrfs_get_extent_fiemap(inode, NULL, 0, 0, |
2160 | root->sectorsize, 0); | 2160 | root->sectorsize, 0); |
@@ -2188,13 +2188,13 @@ static int find_desired_extent(struct inode *inode, loff_t *offset, int origin) | |||
2188 | } | 2188 | } |
2189 | } | 2189 | } |
2190 | 2190 | ||
2191 | if (origin == SEEK_HOLE) { | 2191 | if (whence == SEEK_HOLE) { |
2192 | *offset = start; | 2192 | *offset = start; |
2193 | free_extent_map(em); | 2193 | free_extent_map(em); |
2194 | break; | 2194 | break; |
2195 | } | 2195 | } |
2196 | } else { | 2196 | } else { |
2197 | if (origin == SEEK_DATA) { | 2197 | if (whence == SEEK_DATA) { |
2198 | if (em->block_start == EXTENT_MAP_DELALLOC) { | 2198 | if (em->block_start == EXTENT_MAP_DELALLOC) { |
2199 | if (start >= inode->i_size) { | 2199 | if (start >= inode->i_size) { |
2200 | free_extent_map(em); | 2200 | free_extent_map(em); |
@@ -2231,16 +2231,16 @@ out: | |||
2231 | return ret; | 2231 | return ret; |
2232 | } | 2232 | } |
2233 | 2233 | ||
2234 | static loff_t btrfs_file_llseek(struct file *file, loff_t offset, int origin) | 2234 | static loff_t btrfs_file_llseek(struct file *file, loff_t offset, int whence) |
2235 | { | 2235 | { |
2236 | struct inode *inode = file->f_mapping->host; | 2236 | struct inode *inode = file->f_mapping->host; |
2237 | int ret; | 2237 | int ret; |
2238 | 2238 | ||
2239 | mutex_lock(&inode->i_mutex); | 2239 | mutex_lock(&inode->i_mutex); |
2240 | switch (origin) { | 2240 | switch (whence) { |
2241 | case SEEK_END: | 2241 | case SEEK_END: |
2242 | case SEEK_CUR: | 2242 | case SEEK_CUR: |
2243 | offset = generic_file_llseek(file, offset, origin); | 2243 | offset = generic_file_llseek(file, offset, whence); |
2244 | goto out; | 2244 | goto out; |
2245 | case SEEK_DATA: | 2245 | case SEEK_DATA: |
2246 | case SEEK_HOLE: | 2246 | case SEEK_HOLE: |
@@ -2249,7 +2249,7 @@ static loff_t btrfs_file_llseek(struct file *file, loff_t offset, int origin) | |||
2249 | return -ENXIO; | 2249 | return -ENXIO; |
2250 | } | 2250 | } |
2251 | 2251 | ||
2252 | ret = find_desired_extent(inode, &offset, origin); | 2252 | ret = find_desired_extent(inode, &offset, whence); |
2253 | if (ret) { | 2253 | if (ret) { |
2254 | mutex_unlock(&inode->i_mutex); | 2254 | mutex_unlock(&inode->i_mutex); |
2255 | return ret; | 2255 | return ret; |
diff --git a/fs/ceph/dir.c b/fs/ceph/dir.c index e5b77319c97b..8c1aabe93b67 100644 --- a/fs/ceph/dir.c +++ b/fs/ceph/dir.c | |||
@@ -454,7 +454,7 @@ static void reset_readdir(struct ceph_file_info *fi) | |||
454 | fi->flags &= ~CEPH_F_ATEND; | 454 | fi->flags &= ~CEPH_F_ATEND; |
455 | } | 455 | } |
456 | 456 | ||
457 | static loff_t ceph_dir_llseek(struct file *file, loff_t offset, int origin) | 457 | static loff_t ceph_dir_llseek(struct file *file, loff_t offset, int whence) |
458 | { | 458 | { |
459 | struct ceph_file_info *fi = file->private_data; | 459 | struct ceph_file_info *fi = file->private_data; |
460 | struct inode *inode = file->f_mapping->host; | 460 | struct inode *inode = file->f_mapping->host; |
@@ -463,7 +463,7 @@ static loff_t ceph_dir_llseek(struct file *file, loff_t offset, int origin) | |||
463 | 463 | ||
464 | mutex_lock(&inode->i_mutex); | 464 | mutex_lock(&inode->i_mutex); |
465 | retval = -EINVAL; | 465 | retval = -EINVAL; |
466 | switch (origin) { | 466 | switch (whence) { |
467 | case SEEK_END: | 467 | case SEEK_END: |
468 | offset += inode->i_size + 2; /* FIXME */ | 468 | offset += inode->i_size + 2; /* FIXME */ |
469 | break; | 469 | break; |
diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 5840d2aaed15..d4dfdcf76d7f 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c | |||
@@ -797,7 +797,7 @@ out: | |||
797 | /* | 797 | /* |
798 | * llseek. be sure to verify file size on SEEK_END. | 798 | * llseek. be sure to verify file size on SEEK_END. |
799 | */ | 799 | */ |
800 | static loff_t ceph_llseek(struct file *file, loff_t offset, int origin) | 800 | static loff_t ceph_llseek(struct file *file, loff_t offset, int whence) |
801 | { | 801 | { |
802 | struct inode *inode = file->f_mapping->host; | 802 | struct inode *inode = file->f_mapping->host; |
803 | int ret; | 803 | int ret; |
@@ -805,7 +805,7 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int origin) | |||
805 | mutex_lock(&inode->i_mutex); | 805 | mutex_lock(&inode->i_mutex); |
806 | __ceph_do_pending_vmtruncate(inode); | 806 | __ceph_do_pending_vmtruncate(inode); |
807 | 807 | ||
808 | if (origin == SEEK_END || origin == SEEK_DATA || origin == SEEK_HOLE) { | 808 | if (whence == SEEK_END || whence == SEEK_DATA || whence == SEEK_HOLE) { |
809 | ret = ceph_do_getattr(inode, CEPH_STAT_CAP_SIZE); | 809 | ret = ceph_do_getattr(inode, CEPH_STAT_CAP_SIZE); |
810 | if (ret < 0) { | 810 | if (ret < 0) { |
811 | offset = ret; | 811 | offset = ret; |
@@ -813,7 +813,7 @@ static loff_t ceph_llseek(struct file *file, loff_t offset, int origin) | |||
813 | } | 813 | } |
814 | } | 814 | } |
815 | 815 | ||
816 | switch (origin) { | 816 | switch (whence) { |
817 | case SEEK_END: | 817 | case SEEK_END: |
818 | offset += inode->i_size; | 818 | offset += inode->i_size; |
819 | break; | 819 | break; |
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 210f0af83fc4..ce9f3c5421bf 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c | |||
@@ -695,13 +695,13 @@ static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
695 | return written; | 695 | return written; |
696 | } | 696 | } |
697 | 697 | ||
698 | static loff_t cifs_llseek(struct file *file, loff_t offset, int origin) | 698 | static loff_t cifs_llseek(struct file *file, loff_t offset, int whence) |
699 | { | 699 | { |
700 | /* | 700 | /* |
701 | * origin == SEEK_END || SEEK_DATA || SEEK_HOLE => we must revalidate | 701 | * whence == SEEK_END || SEEK_DATA || SEEK_HOLE => we must revalidate |
702 | * the cached file length | 702 | * the cached file length |
703 | */ | 703 | */ |
704 | if (origin != SEEK_SET && origin != SEEK_CUR) { | 704 | if (whence != SEEK_SET && whence != SEEK_CUR) { |
705 | int rc; | 705 | int rc; |
706 | struct inode *inode = file->f_path.dentry->d_inode; | 706 | struct inode *inode = file->f_path.dentry->d_inode; |
707 | 707 | ||
@@ -728,7 +728,7 @@ static loff_t cifs_llseek(struct file *file, loff_t offset, int origin) | |||
728 | if (rc < 0) | 728 | if (rc < 0) |
729 | return (loff_t)rc; | 729 | return (loff_t)rc; |
730 | } | 730 | } |
731 | return generic_file_llseek(file, offset, origin); | 731 | return generic_file_llseek(file, offset, whence); |
732 | } | 732 | } |
733 | 733 | ||
734 | static int cifs_setlease(struct file *file, long arg, struct file_lock **lease) | 734 | static int cifs_setlease(struct file *file, long arg, struct file_lock **lease) |
diff --git a/fs/configfs/dir.c b/fs/configfs/dir.c index 7414ae24a79b..712b10f64c70 100644 --- a/fs/configfs/dir.c +++ b/fs/configfs/dir.c | |||
@@ -1613,12 +1613,12 @@ static int configfs_readdir(struct file * filp, void * dirent, filldir_t filldir | |||
1613 | return 0; | 1613 | return 0; |
1614 | } | 1614 | } |
1615 | 1615 | ||
1616 | static loff_t configfs_dir_lseek(struct file * file, loff_t offset, int origin) | 1616 | static loff_t configfs_dir_lseek(struct file *file, loff_t offset, int whence) |
1617 | { | 1617 | { |
1618 | struct dentry * dentry = file->f_path.dentry; | 1618 | struct dentry * dentry = file->f_path.dentry; |
1619 | 1619 | ||
1620 | mutex_lock(&dentry->d_inode->i_mutex); | 1620 | mutex_lock(&dentry->d_inode->i_mutex); |
1621 | switch (origin) { | 1621 | switch (whence) { |
1622 | case 1: | 1622 | case 1: |
1623 | offset += file->f_pos; | 1623 | offset += file->f_pos; |
1624 | case 0: | 1624 | case 0: |
diff --git a/fs/eventfd.c b/fs/eventfd.c index d81b9f654086..35470d9b96e6 100644 --- a/fs/eventfd.c +++ b/fs/eventfd.c | |||
@@ -19,6 +19,8 @@ | |||
19 | #include <linux/export.h> | 19 | #include <linux/export.h> |
20 | #include <linux/kref.h> | 20 | #include <linux/kref.h> |
21 | #include <linux/eventfd.h> | 21 | #include <linux/eventfd.h> |
22 | #include <linux/proc_fs.h> | ||
23 | #include <linux/seq_file.h> | ||
22 | 24 | ||
23 | struct eventfd_ctx { | 25 | struct eventfd_ctx { |
24 | struct kref kref; | 26 | struct kref kref; |
@@ -284,7 +286,25 @@ static ssize_t eventfd_write(struct file *file, const char __user *buf, size_t c | |||
284 | return res; | 286 | return res; |
285 | } | 287 | } |
286 | 288 | ||
289 | #ifdef CONFIG_PROC_FS | ||
290 | static int eventfd_show_fdinfo(struct seq_file *m, struct file *f) | ||
291 | { | ||
292 | struct eventfd_ctx *ctx = f->private_data; | ||
293 | int ret; | ||
294 | |||
295 | spin_lock_irq(&ctx->wqh.lock); | ||
296 | ret = seq_printf(m, "eventfd-count: %16llx\n", | ||
297 | (unsigned long long)ctx->count); | ||
298 | spin_unlock_irq(&ctx->wqh.lock); | ||
299 | |||
300 | return ret; | ||
301 | } | ||
302 | #endif | ||
303 | |||
287 | static const struct file_operations eventfd_fops = { | 304 | static const struct file_operations eventfd_fops = { |
305 | #ifdef CONFIG_PROC_FS | ||
306 | .show_fdinfo = eventfd_show_fdinfo, | ||
307 | #endif | ||
288 | .release = eventfd_release, | 308 | .release = eventfd_release, |
289 | .poll = eventfd_poll, | 309 | .poll = eventfd_poll, |
290 | .read = eventfd_read, | 310 | .read = eventfd_read, |
diff --git a/fs/eventpoll.c b/fs/eventpoll.c index cd96649bfe62..be56b21435f8 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c | |||
@@ -38,6 +38,8 @@ | |||
38 | #include <asm/io.h> | 38 | #include <asm/io.h> |
39 | #include <asm/mman.h> | 39 | #include <asm/mman.h> |
40 | #include <linux/atomic.h> | 40 | #include <linux/atomic.h> |
41 | #include <linux/proc_fs.h> | ||
42 | #include <linux/seq_file.h> | ||
41 | 43 | ||
42 | /* | 44 | /* |
43 | * LOCKING: | 45 | * LOCKING: |
@@ -783,8 +785,34 @@ static unsigned int ep_eventpoll_poll(struct file *file, poll_table *wait) | |||
783 | return pollflags != -1 ? pollflags : 0; | 785 | return pollflags != -1 ? pollflags : 0; |
784 | } | 786 | } |
785 | 787 | ||
788 | #ifdef CONFIG_PROC_FS | ||
789 | static int ep_show_fdinfo(struct seq_file *m, struct file *f) | ||
790 | { | ||
791 | struct eventpoll *ep = f->private_data; | ||
792 | struct rb_node *rbp; | ||
793 | int ret = 0; | ||
794 | |||
795 | mutex_lock(&ep->mtx); | ||
796 | for (rbp = rb_first(&ep->rbr); rbp; rbp = rb_next(rbp)) { | ||
797 | struct epitem *epi = rb_entry(rbp, struct epitem, rbn); | ||
798 | |||
799 | ret = seq_printf(m, "tfd: %8d events: %8x data: %16llx\n", | ||
800 | epi->ffd.fd, epi->event.events, | ||
801 | (long long)epi->event.data); | ||
802 | if (ret) | ||
803 | break; | ||
804 | } | ||
805 | mutex_unlock(&ep->mtx); | ||
806 | |||
807 | return ret; | ||
808 | } | ||
809 | #endif | ||
810 | |||
786 | /* File callbacks that implement the eventpoll file behaviour */ | 811 | /* File callbacks that implement the eventpoll file behaviour */ |
787 | static const struct file_operations eventpoll_fops = { | 812 | static const struct file_operations eventpoll_fops = { |
813 | #ifdef CONFIG_PROC_FS | ||
814 | .show_fdinfo = ep_show_fdinfo, | ||
815 | #endif | ||
788 | .release = ep_eventpoll_release, | 816 | .release = ep_eventpoll_release, |
789 | .poll = ep_eventpoll_poll, | 817 | .poll = ep_eventpoll_poll, |
790 | .llseek = noop_llseek, | 818 | .llseek = noop_llseek, |
@@ -1353,6 +1353,10 @@ int search_binary_handler(struct linux_binprm *bprm) | |||
1353 | struct linux_binfmt *fmt; | 1353 | struct linux_binfmt *fmt; |
1354 | pid_t old_pid, old_vpid; | 1354 | pid_t old_pid, old_vpid; |
1355 | 1355 | ||
1356 | /* This allows 4 levels of binfmt rewrites before failing hard. */ | ||
1357 | if (depth > 5) | ||
1358 | return -ELOOP; | ||
1359 | |||
1356 | retval = security_bprm_check(bprm); | 1360 | retval = security_bprm_check(bprm); |
1357 | if (retval) | 1361 | if (retval) |
1358 | return retval; | 1362 | return retval; |
@@ -1377,12 +1381,8 @@ int search_binary_handler(struct linux_binprm *bprm) | |||
1377 | if (!try_module_get(fmt->module)) | 1381 | if (!try_module_get(fmt->module)) |
1378 | continue; | 1382 | continue; |
1379 | read_unlock(&binfmt_lock); | 1383 | read_unlock(&binfmt_lock); |
1384 | bprm->recursion_depth = depth + 1; | ||
1380 | retval = fn(bprm); | 1385 | retval = fn(bprm); |
1381 | /* | ||
1382 | * Restore the depth counter to its starting value | ||
1383 | * in this call, so we don't have to rely on every | ||
1384 | * load_binary function to restore it on return. | ||
1385 | */ | ||
1386 | bprm->recursion_depth = depth; | 1386 | bprm->recursion_depth = depth; |
1387 | if (retval >= 0) { | 1387 | if (retval >= 0) { |
1388 | if (depth == 0) { | 1388 | if (depth == 0) { |
diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c index 29ab099e3e08..606bb074c501 100644 --- a/fs/exportfs/expfs.c +++ b/fs/exportfs/expfs.c | |||
@@ -341,10 +341,21 @@ static int export_encode_fh(struct inode *inode, struct fid *fid, | |||
341 | return type; | 341 | return type; |
342 | } | 342 | } |
343 | 343 | ||
344 | int exportfs_encode_inode_fh(struct inode *inode, struct fid *fid, | ||
345 | int *max_len, struct inode *parent) | ||
346 | { | ||
347 | const struct export_operations *nop = inode->i_sb->s_export_op; | ||
348 | |||
349 | if (nop && nop->encode_fh) | ||
350 | return nop->encode_fh(inode, fid->raw, max_len, parent); | ||
351 | |||
352 | return export_encode_fh(inode, fid, max_len, parent); | ||
353 | } | ||
354 | EXPORT_SYMBOL_GPL(exportfs_encode_inode_fh); | ||
355 | |||
344 | int exportfs_encode_fh(struct dentry *dentry, struct fid *fid, int *max_len, | 356 | int exportfs_encode_fh(struct dentry *dentry, struct fid *fid, int *max_len, |
345 | int connectable) | 357 | int connectable) |
346 | { | 358 | { |
347 | const struct export_operations *nop = dentry->d_sb->s_export_op; | ||
348 | int error; | 359 | int error; |
349 | struct dentry *p = NULL; | 360 | struct dentry *p = NULL; |
350 | struct inode *inode = dentry->d_inode, *parent = NULL; | 361 | struct inode *inode = dentry->d_inode, *parent = NULL; |
@@ -357,10 +368,8 @@ int exportfs_encode_fh(struct dentry *dentry, struct fid *fid, int *max_len, | |||
357 | */ | 368 | */ |
358 | parent = p->d_inode; | 369 | parent = p->d_inode; |
359 | } | 370 | } |
360 | if (nop->encode_fh) | 371 | |
361 | error = nop->encode_fh(inode, fid->raw, max_len, parent); | 372 | error = exportfs_encode_inode_fh(inode, fid, max_len, parent); |
362 | else | ||
363 | error = export_encode_fh(inode, fid, max_len, parent); | ||
364 | dput(p); | 373 | dput(p); |
365 | 374 | ||
366 | return error; | 375 | return error; |
diff --git a/fs/ext3/dir.c b/fs/ext3/dir.c index c8fff930790d..dd91264ba94f 100644 --- a/fs/ext3/dir.c +++ b/fs/ext3/dir.c | |||
@@ -296,17 +296,17 @@ static inline loff_t ext3_get_htree_eof(struct file *filp) | |||
296 | * NOTE: offsets obtained *before* ext3_set_inode_flag(dir, EXT3_INODE_INDEX) | 296 | * NOTE: offsets obtained *before* ext3_set_inode_flag(dir, EXT3_INODE_INDEX) |
297 | * will be invalid once the directory was converted into a dx directory | 297 | * will be invalid once the directory was converted into a dx directory |
298 | */ | 298 | */ |
299 | loff_t ext3_dir_llseek(struct file *file, loff_t offset, int origin) | 299 | loff_t ext3_dir_llseek(struct file *file, loff_t offset, int whence) |
300 | { | 300 | { |
301 | struct inode *inode = file->f_mapping->host; | 301 | struct inode *inode = file->f_mapping->host; |
302 | int dx_dir = is_dx_dir(inode); | 302 | int dx_dir = is_dx_dir(inode); |
303 | loff_t htree_max = ext3_get_htree_eof(file); | 303 | loff_t htree_max = ext3_get_htree_eof(file); |
304 | 304 | ||
305 | if (likely(dx_dir)) | 305 | if (likely(dx_dir)) |
306 | return generic_file_llseek_size(file, offset, origin, | 306 | return generic_file_llseek_size(file, offset, whence, |
307 | htree_max, htree_max); | 307 | htree_max, htree_max); |
308 | else | 308 | else |
309 | return generic_file_llseek(file, offset, origin); | 309 | return generic_file_llseek(file, offset, whence); |
310 | } | 310 | } |
311 | 311 | ||
312 | /* | 312 | /* |
diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c index b8d877f6c1fa..80a28b297279 100644 --- a/fs/ext4/dir.c +++ b/fs/ext4/dir.c | |||
@@ -333,17 +333,17 @@ static inline loff_t ext4_get_htree_eof(struct file *filp) | |||
333 | * | 333 | * |
334 | * For non-htree, ext4_llseek already chooses the proper max offset. | 334 | * For non-htree, ext4_llseek already chooses the proper max offset. |
335 | */ | 335 | */ |
336 | loff_t ext4_dir_llseek(struct file *file, loff_t offset, int origin) | 336 | loff_t ext4_dir_llseek(struct file *file, loff_t offset, int whence) |
337 | { | 337 | { |
338 | struct inode *inode = file->f_mapping->host; | 338 | struct inode *inode = file->f_mapping->host; |
339 | int dx_dir = is_dx_dir(inode); | 339 | int dx_dir = is_dx_dir(inode); |
340 | loff_t htree_max = ext4_get_htree_eof(file); | 340 | loff_t htree_max = ext4_get_htree_eof(file); |
341 | 341 | ||
342 | if (likely(dx_dir)) | 342 | if (likely(dx_dir)) |
343 | return generic_file_llseek_size(file, offset, origin, | 343 | return generic_file_llseek_size(file, offset, whence, |
344 | htree_max, htree_max); | 344 | htree_max, htree_max); |
345 | else | 345 | else |
346 | return ext4_llseek(file, offset, origin); | 346 | return ext4_llseek(file, offset, whence); |
347 | } | 347 | } |
348 | 348 | ||
349 | /* | 349 | /* |
diff --git a/fs/ext4/file.c b/fs/ext4/file.c index b64a60bf105a..d07c27ca594a 100644 --- a/fs/ext4/file.c +++ b/fs/ext4/file.c | |||
@@ -303,7 +303,7 @@ static int ext4_file_open(struct inode * inode, struct file * filp) | |||
303 | * page cache has data or not. | 303 | * page cache has data or not. |
304 | */ | 304 | */ |
305 | static int ext4_find_unwritten_pgoff(struct inode *inode, | 305 | static int ext4_find_unwritten_pgoff(struct inode *inode, |
306 | int origin, | 306 | int whence, |
307 | struct ext4_map_blocks *map, | 307 | struct ext4_map_blocks *map, |
308 | loff_t *offset) | 308 | loff_t *offset) |
309 | { | 309 | { |
@@ -333,10 +333,10 @@ static int ext4_find_unwritten_pgoff(struct inode *inode, | |||
333 | nr_pages = pagevec_lookup(&pvec, inode->i_mapping, index, | 333 | nr_pages = pagevec_lookup(&pvec, inode->i_mapping, index, |
334 | (pgoff_t)num); | 334 | (pgoff_t)num); |
335 | if (nr_pages == 0) { | 335 | if (nr_pages == 0) { |
336 | if (origin == SEEK_DATA) | 336 | if (whence == SEEK_DATA) |
337 | break; | 337 | break; |
338 | 338 | ||
339 | BUG_ON(origin != SEEK_HOLE); | 339 | BUG_ON(whence != SEEK_HOLE); |
340 | /* | 340 | /* |
341 | * If this is the first time to go into the loop and | 341 | * If this is the first time to go into the loop and |
342 | * offset is not beyond the end offset, it will be a | 342 | * offset is not beyond the end offset, it will be a |
@@ -352,7 +352,7 @@ static int ext4_find_unwritten_pgoff(struct inode *inode, | |||
352 | * offset is smaller than the first page offset, it will be a | 352 | * offset is smaller than the first page offset, it will be a |
353 | * hole at this offset. | 353 | * hole at this offset. |
354 | */ | 354 | */ |
355 | if (lastoff == startoff && origin == SEEK_HOLE && | 355 | if (lastoff == startoff && whence == SEEK_HOLE && |
356 | lastoff < page_offset(pvec.pages[0])) { | 356 | lastoff < page_offset(pvec.pages[0])) { |
357 | found = 1; | 357 | found = 1; |
358 | break; | 358 | break; |
@@ -366,7 +366,7 @@ static int ext4_find_unwritten_pgoff(struct inode *inode, | |||
366 | * If the current offset is not beyond the end of given | 366 | * If the current offset is not beyond the end of given |
367 | * range, it will be a hole. | 367 | * range, it will be a hole. |
368 | */ | 368 | */ |
369 | if (lastoff < endoff && origin == SEEK_HOLE && | 369 | if (lastoff < endoff && whence == SEEK_HOLE && |
370 | page->index > end) { | 370 | page->index > end) { |
371 | found = 1; | 371 | found = 1; |
372 | *offset = lastoff; | 372 | *offset = lastoff; |
@@ -391,10 +391,10 @@ static int ext4_find_unwritten_pgoff(struct inode *inode, | |||
391 | do { | 391 | do { |
392 | if (buffer_uptodate(bh) || | 392 | if (buffer_uptodate(bh) || |
393 | buffer_unwritten(bh)) { | 393 | buffer_unwritten(bh)) { |
394 | if (origin == SEEK_DATA) | 394 | if (whence == SEEK_DATA) |
395 | found = 1; | 395 | found = 1; |
396 | } else { | 396 | } else { |
397 | if (origin == SEEK_HOLE) | 397 | if (whence == SEEK_HOLE) |
398 | found = 1; | 398 | found = 1; |
399 | } | 399 | } |
400 | if (found) { | 400 | if (found) { |
@@ -416,7 +416,7 @@ static int ext4_find_unwritten_pgoff(struct inode *inode, | |||
416 | * The no. of pages is less than our desired, that would be a | 416 | * The no. of pages is less than our desired, that would be a |
417 | * hole in there. | 417 | * hole in there. |
418 | */ | 418 | */ |
419 | if (nr_pages < num && origin == SEEK_HOLE) { | 419 | if (nr_pages < num && whence == SEEK_HOLE) { |
420 | found = 1; | 420 | found = 1; |
421 | *offset = lastoff; | 421 | *offset = lastoff; |
422 | break; | 422 | break; |
@@ -609,7 +609,7 @@ static loff_t ext4_seek_hole(struct file *file, loff_t offset, loff_t maxsize) | |||
609 | * by calling generic_file_llseek_size() with the appropriate maxbytes | 609 | * by calling generic_file_llseek_size() with the appropriate maxbytes |
610 | * value for each. | 610 | * value for each. |
611 | */ | 611 | */ |
612 | loff_t ext4_llseek(struct file *file, loff_t offset, int origin) | 612 | loff_t ext4_llseek(struct file *file, loff_t offset, int whence) |
613 | { | 613 | { |
614 | struct inode *inode = file->f_mapping->host; | 614 | struct inode *inode = file->f_mapping->host; |
615 | loff_t maxbytes; | 615 | loff_t maxbytes; |
@@ -619,11 +619,11 @@ loff_t ext4_llseek(struct file *file, loff_t offset, int origin) | |||
619 | else | 619 | else |
620 | maxbytes = inode->i_sb->s_maxbytes; | 620 | maxbytes = inode->i_sb->s_maxbytes; |
621 | 621 | ||
622 | switch (origin) { | 622 | switch (whence) { |
623 | case SEEK_SET: | 623 | case SEEK_SET: |
624 | case SEEK_CUR: | 624 | case SEEK_CUR: |
625 | case SEEK_END: | 625 | case SEEK_END: |
626 | return generic_file_llseek_size(file, offset, origin, | 626 | return generic_file_llseek_size(file, offset, whence, |
627 | maxbytes, i_size_read(inode)); | 627 | maxbytes, i_size_read(inode)); |
628 | case SEEK_DATA: | 628 | case SEEK_DATA: |
629 | return ext4_seek_data(file, offset, maxbytes); | 629 | return ext4_seek_data(file, offset, maxbytes); |
diff --git a/fs/fat/fat.h b/fs/fat/fat.h index 623f36f0423b..12701a567752 100644 --- a/fs/fat/fat.h +++ b/fs/fat/fat.h | |||
@@ -29,6 +29,7 @@ struct fat_mount_options { | |||
29 | unsigned short fs_fmask; | 29 | unsigned short fs_fmask; |
30 | unsigned short fs_dmask; | 30 | unsigned short fs_dmask; |
31 | unsigned short codepage; /* Codepage for shortname conversions */ | 31 | unsigned short codepage; /* Codepage for shortname conversions */ |
32 | int time_offset; /* Offset of timestamps from UTC (in minutes) */ | ||
32 | char *iocharset; /* Charset used for filename input/display */ | 33 | char *iocharset; /* Charset used for filename input/display */ |
33 | unsigned short shortname; /* flags for shortname display/create rule */ | 34 | unsigned short shortname; /* flags for shortname display/create rule */ |
34 | unsigned char name_check; /* r = relaxed, n = normal, s = strict */ | 35 | unsigned char name_check; /* r = relaxed, n = normal, s = strict */ |
@@ -45,7 +46,7 @@ struct fat_mount_options { | |||
45 | flush:1, /* write things quickly */ | 46 | flush:1, /* write things quickly */ |
46 | nocase:1, /* Does this need case conversion? 0=need case conversion*/ | 47 | nocase:1, /* Does this need case conversion? 0=need case conversion*/ |
47 | usefree:1, /* Use free_clusters for FAT32 */ | 48 | usefree:1, /* Use free_clusters for FAT32 */ |
48 | tz_utc:1, /* Filesystem timestamps are in UTC */ | 49 | tz_set:1, /* Filesystem timestamps' offset set */ |
49 | rodir:1, /* allow ATTR_RO for directory */ | 50 | rodir:1, /* allow ATTR_RO for directory */ |
50 | discard:1, /* Issue discard requests on deletions */ | 51 | discard:1, /* Issue discard requests on deletions */ |
51 | nfs:1; /* Do extra work needed for NFS export */ | 52 | nfs:1; /* Do extra work needed for NFS export */ |
diff --git a/fs/fat/inode.c b/fs/fat/inode.c index 5bafaad00530..35806813ea4e 100644 --- a/fs/fat/inode.c +++ b/fs/fat/inode.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/writeback.h> | 26 | #include <linux/writeback.h> |
27 | #include <linux/log2.h> | 27 | #include <linux/log2.h> |
28 | #include <linux/hash.h> | 28 | #include <linux/hash.h> |
29 | #include <linux/blkdev.h> | ||
29 | #include <asm/unaligned.h> | 30 | #include <asm/unaligned.h> |
30 | #include "fat.h" | 31 | #include "fat.h" |
31 | 32 | ||
@@ -725,7 +726,8 @@ static int fat_show_options(struct seq_file *m, struct dentry *root) | |||
725 | if (opts->allow_utime) | 726 | if (opts->allow_utime) |
726 | seq_printf(m, ",allow_utime=%04o", opts->allow_utime); | 727 | seq_printf(m, ",allow_utime=%04o", opts->allow_utime); |
727 | if (sbi->nls_disk) | 728 | if (sbi->nls_disk) |
728 | seq_printf(m, ",codepage=%s", sbi->nls_disk->charset); | 729 | /* strip "cp" prefix from displayed option */ |
730 | seq_printf(m, ",codepage=%s", &sbi->nls_disk->charset[2]); | ||
729 | if (isvfat) { | 731 | if (isvfat) { |
730 | if (sbi->nls_io) | 732 | if (sbi->nls_io) |
731 | seq_printf(m, ",iocharset=%s", sbi->nls_io->charset); | 733 | seq_printf(m, ",iocharset=%s", sbi->nls_io->charset); |
@@ -777,8 +779,12 @@ static int fat_show_options(struct seq_file *m, struct dentry *root) | |||
777 | } | 779 | } |
778 | if (opts->flush) | 780 | if (opts->flush) |
779 | seq_puts(m, ",flush"); | 781 | seq_puts(m, ",flush"); |
780 | if (opts->tz_utc) | 782 | if (opts->tz_set) { |
781 | seq_puts(m, ",tz=UTC"); | 783 | if (opts->time_offset) |
784 | seq_printf(m, ",time_offset=%d", opts->time_offset); | ||
785 | else | ||
786 | seq_puts(m, ",tz=UTC"); | ||
787 | } | ||
782 | if (opts->errors == FAT_ERRORS_CONT) | 788 | if (opts->errors == FAT_ERRORS_CONT) |
783 | seq_puts(m, ",errors=continue"); | 789 | seq_puts(m, ",errors=continue"); |
784 | else if (opts->errors == FAT_ERRORS_PANIC) | 790 | else if (opts->errors == FAT_ERRORS_PANIC) |
@@ -800,7 +806,8 @@ enum { | |||
800 | Opt_shortname_winnt, Opt_shortname_mixed, Opt_utf8_no, Opt_utf8_yes, | 806 | Opt_shortname_winnt, Opt_shortname_mixed, Opt_utf8_no, Opt_utf8_yes, |
801 | Opt_uni_xl_no, Opt_uni_xl_yes, Opt_nonumtail_no, Opt_nonumtail_yes, | 807 | Opt_uni_xl_no, Opt_uni_xl_yes, Opt_nonumtail_no, Opt_nonumtail_yes, |
802 | Opt_obsolete, Opt_flush, Opt_tz_utc, Opt_rodir, Opt_err_cont, | 808 | Opt_obsolete, Opt_flush, Opt_tz_utc, Opt_rodir, Opt_err_cont, |
803 | Opt_err_panic, Opt_err_ro, Opt_discard, Opt_nfs, Opt_err, | 809 | Opt_err_panic, Opt_err_ro, Opt_discard, Opt_nfs, Opt_time_offset, |
810 | Opt_err, | ||
804 | }; | 811 | }; |
805 | 812 | ||
806 | static const match_table_t fat_tokens = { | 813 | static const match_table_t fat_tokens = { |
@@ -825,6 +832,7 @@ static const match_table_t fat_tokens = { | |||
825 | {Opt_immutable, "sys_immutable"}, | 832 | {Opt_immutable, "sys_immutable"}, |
826 | {Opt_flush, "flush"}, | 833 | {Opt_flush, "flush"}, |
827 | {Opt_tz_utc, "tz=UTC"}, | 834 | {Opt_tz_utc, "tz=UTC"}, |
835 | {Opt_time_offset, "time_offset=%d"}, | ||
828 | {Opt_err_cont, "errors=continue"}, | 836 | {Opt_err_cont, "errors=continue"}, |
829 | {Opt_err_panic, "errors=panic"}, | 837 | {Opt_err_panic, "errors=panic"}, |
830 | {Opt_err_ro, "errors=remount-ro"}, | 838 | {Opt_err_ro, "errors=remount-ro"}, |
@@ -909,7 +917,7 @@ static int parse_options(struct super_block *sb, char *options, int is_vfat, | |||
909 | opts->utf8 = opts->unicode_xlate = 0; | 917 | opts->utf8 = opts->unicode_xlate = 0; |
910 | opts->numtail = 1; | 918 | opts->numtail = 1; |
911 | opts->usefree = opts->nocase = 0; | 919 | opts->usefree = opts->nocase = 0; |
912 | opts->tz_utc = 0; | 920 | opts->tz_set = 0; |
913 | opts->nfs = 0; | 921 | opts->nfs = 0; |
914 | opts->errors = FAT_ERRORS_RO; | 922 | opts->errors = FAT_ERRORS_RO; |
915 | *debug = 0; | 923 | *debug = 0; |
@@ -965,48 +973,57 @@ static int parse_options(struct super_block *sb, char *options, int is_vfat, | |||
965 | break; | 973 | break; |
966 | case Opt_uid: | 974 | case Opt_uid: |
967 | if (match_int(&args[0], &option)) | 975 | if (match_int(&args[0], &option)) |
968 | return 0; | 976 | return -EINVAL; |
969 | opts->fs_uid = make_kuid(current_user_ns(), option); | 977 | opts->fs_uid = make_kuid(current_user_ns(), option); |
970 | if (!uid_valid(opts->fs_uid)) | 978 | if (!uid_valid(opts->fs_uid)) |
971 | return 0; | 979 | return -EINVAL; |
972 | break; | 980 | break; |
973 | case Opt_gid: | 981 | case Opt_gid: |
974 | if (match_int(&args[0], &option)) | 982 | if (match_int(&args[0], &option)) |
975 | return 0; | 983 | return -EINVAL; |
976 | opts->fs_gid = make_kgid(current_user_ns(), option); | 984 | opts->fs_gid = make_kgid(current_user_ns(), option); |
977 | if (!gid_valid(opts->fs_gid)) | 985 | if (!gid_valid(opts->fs_gid)) |
978 | return 0; | 986 | return -EINVAL; |
979 | break; | 987 | break; |
980 | case Opt_umask: | 988 | case Opt_umask: |
981 | if (match_octal(&args[0], &option)) | 989 | if (match_octal(&args[0], &option)) |
982 | return 0; | 990 | return -EINVAL; |
983 | opts->fs_fmask = opts->fs_dmask = option; | 991 | opts->fs_fmask = opts->fs_dmask = option; |
984 | break; | 992 | break; |
985 | case Opt_dmask: | 993 | case Opt_dmask: |
986 | if (match_octal(&args[0], &option)) | 994 | if (match_octal(&args[0], &option)) |
987 | return 0; | 995 | return -EINVAL; |
988 | opts->fs_dmask = option; | 996 | opts->fs_dmask = option; |
989 | break; | 997 | break; |
990 | case Opt_fmask: | 998 | case Opt_fmask: |
991 | if (match_octal(&args[0], &option)) | 999 | if (match_octal(&args[0], &option)) |
992 | return 0; | 1000 | return -EINVAL; |
993 | opts->fs_fmask = option; | 1001 | opts->fs_fmask = option; |
994 | break; | 1002 | break; |
995 | case Opt_allow_utime: | 1003 | case Opt_allow_utime: |
996 | if (match_octal(&args[0], &option)) | 1004 | if (match_octal(&args[0], &option)) |
997 | return 0; | 1005 | return -EINVAL; |
998 | opts->allow_utime = option & (S_IWGRP | S_IWOTH); | 1006 | opts->allow_utime = option & (S_IWGRP | S_IWOTH); |
999 | break; | 1007 | break; |
1000 | case Opt_codepage: | 1008 | case Opt_codepage: |
1001 | if (match_int(&args[0], &option)) | 1009 | if (match_int(&args[0], &option)) |
1002 | return 0; | 1010 | return -EINVAL; |
1003 | opts->codepage = option; | 1011 | opts->codepage = option; |
1004 | break; | 1012 | break; |
1005 | case Opt_flush: | 1013 | case Opt_flush: |
1006 | opts->flush = 1; | 1014 | opts->flush = 1; |
1007 | break; | 1015 | break; |
1016 | case Opt_time_offset: | ||
1017 | if (match_int(&args[0], &option)) | ||
1018 | return -EINVAL; | ||
1019 | if (option < -12 * 60 || option > 12 * 60) | ||
1020 | return -EINVAL; | ||
1021 | opts->tz_set = 1; | ||
1022 | opts->time_offset = option; | ||
1023 | break; | ||
1008 | case Opt_tz_utc: | 1024 | case Opt_tz_utc: |
1009 | opts->tz_utc = 1; | 1025 | opts->tz_set = 1; |
1026 | opts->time_offset = 0; | ||
1010 | break; | 1027 | break; |
1011 | case Opt_err_cont: | 1028 | case Opt_err_cont: |
1012 | opts->errors = FAT_ERRORS_CONT; | 1029 | opts->errors = FAT_ERRORS_CONT; |
@@ -1431,6 +1448,14 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat, | |||
1431 | goto out_fail; | 1448 | goto out_fail; |
1432 | } | 1449 | } |
1433 | 1450 | ||
1451 | if (sbi->options.discard) { | ||
1452 | struct request_queue *q = bdev_get_queue(sb->s_bdev); | ||
1453 | if (!blk_queue_discard(q)) | ||
1454 | fat_msg(sb, KERN_WARNING, | ||
1455 | "mounting with \"discard\" option, but " | ||
1456 | "the device does not support discard"); | ||
1457 | } | ||
1458 | |||
1434 | return 0; | 1459 | return 0; |
1435 | 1460 | ||
1436 | out_invalid: | 1461 | out_invalid: |
diff --git a/fs/fat/misc.c b/fs/fat/misc.c index 6d93360ca0cc..5eb600dc43a9 100644 --- a/fs/fat/misc.c +++ b/fs/fat/misc.c | |||
@@ -212,8 +212,10 @@ void fat_time_fat2unix(struct msdos_sb_info *sbi, struct timespec *ts, | |||
212 | + days_in_year[month] + day | 212 | + days_in_year[month] + day |
213 | + DAYS_DELTA) * SECS_PER_DAY; | 213 | + DAYS_DELTA) * SECS_PER_DAY; |
214 | 214 | ||
215 | if (!sbi->options.tz_utc) | 215 | if (!sbi->options.tz_set) |
216 | second += sys_tz.tz_minuteswest * SECS_PER_MIN; | 216 | second += sys_tz.tz_minuteswest * SECS_PER_MIN; |
217 | else | ||
218 | second -= sbi->options.time_offset * SECS_PER_MIN; | ||
217 | 219 | ||
218 | if (time_cs) { | 220 | if (time_cs) { |
219 | ts->tv_sec = second + (time_cs / 100); | 221 | ts->tv_sec = second + (time_cs / 100); |
@@ -229,8 +231,9 @@ void fat_time_unix2fat(struct msdos_sb_info *sbi, struct timespec *ts, | |||
229 | __le16 *time, __le16 *date, u8 *time_cs) | 231 | __le16 *time, __le16 *date, u8 *time_cs) |
230 | { | 232 | { |
231 | struct tm tm; | 233 | struct tm tm; |
232 | time_to_tm(ts->tv_sec, sbi->options.tz_utc ? 0 : | 234 | time_to_tm(ts->tv_sec, |
233 | -sys_tz.tz_minuteswest * 60, &tm); | 235 | (sbi->options.tz_set ? sbi->options.time_offset : |
236 | -sys_tz.tz_minuteswest) * SECS_PER_MIN, &tm); | ||
234 | 237 | ||
235 | /* FAT can only support year between 1980 to 2107 */ | 238 | /* FAT can only support year between 1980 to 2107 */ |
236 | if (tm.tm_year < 1980 - 1900) { | 239 | if (tm.tm_year < 1980 - 1900) { |
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 78d2837bc940..e21d4d8f87e3 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -1599,19 +1599,19 @@ static sector_t fuse_bmap(struct address_space *mapping, sector_t block) | |||
1599 | return err ? 0 : outarg.block; | 1599 | return err ? 0 : outarg.block; |
1600 | } | 1600 | } |
1601 | 1601 | ||
1602 | static loff_t fuse_file_llseek(struct file *file, loff_t offset, int origin) | 1602 | static loff_t fuse_file_llseek(struct file *file, loff_t offset, int whence) |
1603 | { | 1603 | { |
1604 | loff_t retval; | 1604 | loff_t retval; |
1605 | struct inode *inode = file->f_path.dentry->d_inode; | 1605 | struct inode *inode = file->f_path.dentry->d_inode; |
1606 | 1606 | ||
1607 | /* No i_mutex protection necessary for SEEK_CUR and SEEK_SET */ | 1607 | /* No i_mutex protection necessary for SEEK_CUR and SEEK_SET */ |
1608 | if (origin == SEEK_CUR || origin == SEEK_SET) | 1608 | if (whence == SEEK_CUR || whence == SEEK_SET) |
1609 | return generic_file_llseek(file, offset, origin); | 1609 | return generic_file_llseek(file, offset, whence); |
1610 | 1610 | ||
1611 | mutex_lock(&inode->i_mutex); | 1611 | mutex_lock(&inode->i_mutex); |
1612 | retval = fuse_update_attributes(inode, NULL, file, NULL); | 1612 | retval = fuse_update_attributes(inode, NULL, file, NULL); |
1613 | if (!retval) | 1613 | if (!retval) |
1614 | retval = generic_file_llseek(file, offset, origin); | 1614 | retval = generic_file_llseek(file, offset, whence); |
1615 | mutex_unlock(&inode->i_mutex); | 1615 | mutex_unlock(&inode->i_mutex); |
1616 | 1616 | ||
1617 | return retval; | 1617 | return retval; |
diff --git a/fs/gfs2/file.c b/fs/gfs2/file.c index dfe2d8cb9b2c..991ab2d484dd 100644 --- a/fs/gfs2/file.c +++ b/fs/gfs2/file.c | |||
@@ -44,7 +44,7 @@ | |||
44 | * gfs2_llseek - seek to a location in a file | 44 | * gfs2_llseek - seek to a location in a file |
45 | * @file: the file | 45 | * @file: the file |
46 | * @offset: the offset | 46 | * @offset: the offset |
47 | * @origin: Where to seek from (SEEK_SET, SEEK_CUR, or SEEK_END) | 47 | * @whence: Where to seek from (SEEK_SET, SEEK_CUR, or SEEK_END) |
48 | * | 48 | * |
49 | * SEEK_END requires the glock for the file because it references the | 49 | * SEEK_END requires the glock for the file because it references the |
50 | * file's size. | 50 | * file's size. |
@@ -52,26 +52,26 @@ | |||
52 | * Returns: The new offset, or errno | 52 | * Returns: The new offset, or errno |
53 | */ | 53 | */ |
54 | 54 | ||
55 | static loff_t gfs2_llseek(struct file *file, loff_t offset, int origin) | 55 | static loff_t gfs2_llseek(struct file *file, loff_t offset, int whence) |
56 | { | 56 | { |
57 | struct gfs2_inode *ip = GFS2_I(file->f_mapping->host); | 57 | struct gfs2_inode *ip = GFS2_I(file->f_mapping->host); |
58 | struct gfs2_holder i_gh; | 58 | struct gfs2_holder i_gh; |
59 | loff_t error; | 59 | loff_t error; |
60 | 60 | ||
61 | switch (origin) { | 61 | switch (whence) { |
62 | case SEEK_END: /* These reference inode->i_size */ | 62 | case SEEK_END: /* These reference inode->i_size */ |
63 | case SEEK_DATA: | 63 | case SEEK_DATA: |
64 | case SEEK_HOLE: | 64 | case SEEK_HOLE: |
65 | error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, | 65 | error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, |
66 | &i_gh); | 66 | &i_gh); |
67 | if (!error) { | 67 | if (!error) { |
68 | error = generic_file_llseek(file, offset, origin); | 68 | error = generic_file_llseek(file, offset, whence); |
69 | gfs2_glock_dq_uninit(&i_gh); | 69 | gfs2_glock_dq_uninit(&i_gh); |
70 | } | 70 | } |
71 | break; | 71 | break; |
72 | case SEEK_CUR: | 72 | case SEEK_CUR: |
73 | case SEEK_SET: | 73 | case SEEK_SET: |
74 | error = generic_file_llseek(file, offset, origin); | 74 | error = generic_file_llseek(file, offset, whence); |
75 | break; | 75 | break; |
76 | default: | 76 | default: |
77 | error = -EINVAL; | 77 | error = -EINVAL; |
diff --git a/fs/libfs.c b/fs/libfs.c index 7cc37ca19cd8..35fc6e74cd88 100644 --- a/fs/libfs.c +++ b/fs/libfs.c | |||
@@ -81,11 +81,11 @@ int dcache_dir_close(struct inode *inode, struct file *file) | |||
81 | return 0; | 81 | return 0; |
82 | } | 82 | } |
83 | 83 | ||
84 | loff_t dcache_dir_lseek(struct file *file, loff_t offset, int origin) | 84 | loff_t dcache_dir_lseek(struct file *file, loff_t offset, int whence) |
85 | { | 85 | { |
86 | struct dentry *dentry = file->f_path.dentry; | 86 | struct dentry *dentry = file->f_path.dentry; |
87 | mutex_lock(&dentry->d_inode->i_mutex); | 87 | mutex_lock(&dentry->d_inode->i_mutex); |
88 | switch (origin) { | 88 | switch (whence) { |
89 | case 1: | 89 | case 1: |
90 | offset += file->f_pos; | 90 | offset += file->f_pos; |
91 | case 0: | 91 | case 0: |
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index b9e66b7e0c14..1cc71f60b491 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c | |||
@@ -871,7 +871,7 @@ out: | |||
871 | return res; | 871 | return res; |
872 | } | 872 | } |
873 | 873 | ||
874 | static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int origin) | 874 | static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int whence) |
875 | { | 875 | { |
876 | struct dentry *dentry = filp->f_path.dentry; | 876 | struct dentry *dentry = filp->f_path.dentry; |
877 | struct inode *inode = dentry->d_inode; | 877 | struct inode *inode = dentry->d_inode; |
@@ -880,10 +880,10 @@ static loff_t nfs_llseek_dir(struct file *filp, loff_t offset, int origin) | |||
880 | dfprintk(FILE, "NFS: llseek dir(%s/%s, %lld, %d)\n", | 880 | dfprintk(FILE, "NFS: llseek dir(%s/%s, %lld, %d)\n", |
881 | dentry->d_parent->d_name.name, | 881 | dentry->d_parent->d_name.name, |
882 | dentry->d_name.name, | 882 | dentry->d_name.name, |
883 | offset, origin); | 883 | offset, whence); |
884 | 884 | ||
885 | mutex_lock(&inode->i_mutex); | 885 | mutex_lock(&inode->i_mutex); |
886 | switch (origin) { | 886 | switch (whence) { |
887 | case 1: | 887 | case 1: |
888 | offset += filp->f_pos; | 888 | offset += filp->f_pos; |
889 | case 0: | 889 | case 0: |
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 582bb8866131..3c2b893665ba 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c | |||
@@ -119,18 +119,18 @@ force_reval: | |||
119 | return __nfs_revalidate_inode(server, inode); | 119 | return __nfs_revalidate_inode(server, inode); |
120 | } | 120 | } |
121 | 121 | ||
122 | loff_t nfs_file_llseek(struct file *filp, loff_t offset, int origin) | 122 | loff_t nfs_file_llseek(struct file *filp, loff_t offset, int whence) |
123 | { | 123 | { |
124 | dprintk("NFS: llseek file(%s/%s, %lld, %d)\n", | 124 | dprintk("NFS: llseek file(%s/%s, %lld, %d)\n", |
125 | filp->f_path.dentry->d_parent->d_name.name, | 125 | filp->f_path.dentry->d_parent->d_name.name, |
126 | filp->f_path.dentry->d_name.name, | 126 | filp->f_path.dentry->d_name.name, |
127 | offset, origin); | 127 | offset, whence); |
128 | 128 | ||
129 | /* | 129 | /* |
130 | * origin == SEEK_END || SEEK_DATA || SEEK_HOLE => we must revalidate | 130 | * whence == SEEK_END || SEEK_DATA || SEEK_HOLE => we must revalidate |
131 | * the cached file length | 131 | * the cached file length |
132 | */ | 132 | */ |
133 | if (origin != SEEK_SET && origin != SEEK_CUR) { | 133 | if (whence != SEEK_SET && whence != SEEK_CUR) { |
134 | struct inode *inode = filp->f_mapping->host; | 134 | struct inode *inode = filp->f_mapping->host; |
135 | 135 | ||
136 | int retval = nfs_revalidate_file_size(inode, filp); | 136 | int retval = nfs_revalidate_file_size(inode, filp); |
@@ -138,7 +138,7 @@ loff_t nfs_file_llseek(struct file *filp, loff_t offset, int origin) | |||
138 | return (loff_t)retval; | 138 | return (loff_t)retval; |
139 | } | 139 | } |
140 | 140 | ||
141 | return generic_file_llseek(filp, offset, origin); | 141 | return generic_file_llseek(filp, offset, whence); |
142 | } | 142 | } |
143 | EXPORT_SYMBOL_GPL(nfs_file_llseek); | 143 | EXPORT_SYMBOL_GPL(nfs_file_llseek); |
144 | 144 | ||
diff --git a/fs/notify/Makefile b/fs/notify/Makefile index ae5f33a6d868..96d3420d0242 100644 --- a/fs/notify/Makefile +++ b/fs/notify/Makefile | |||
@@ -1,5 +1,5 @@ | |||
1 | obj-$(CONFIG_FSNOTIFY) += fsnotify.o notification.o group.o inode_mark.o \ | 1 | obj-$(CONFIG_FSNOTIFY) += fsnotify.o notification.o group.o inode_mark.o \ |
2 | mark.o vfsmount_mark.o | 2 | mark.o vfsmount_mark.o fdinfo.o |
3 | 3 | ||
4 | obj-y += dnotify/ | 4 | obj-y += dnotify/ |
5 | obj-y += inotify/ | 5 | obj-y += inotify/ |
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c index 6fcaeb8c902e..a5cd9bba022f 100644 --- a/fs/notify/fanotify/fanotify_user.c +++ b/fs/notify/fanotify/fanotify_user.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <asm/ioctls.h> | 17 | #include <asm/ioctls.h> |
18 | 18 | ||
19 | #include "../../mount.h" | 19 | #include "../../mount.h" |
20 | #include "../fdinfo.h" | ||
20 | 21 | ||
21 | #define FANOTIFY_DEFAULT_MAX_EVENTS 16384 | 22 | #define FANOTIFY_DEFAULT_MAX_EVENTS 16384 |
22 | #define FANOTIFY_DEFAULT_MAX_MARKS 8192 | 23 | #define FANOTIFY_DEFAULT_MAX_MARKS 8192 |
@@ -428,6 +429,7 @@ static long fanotify_ioctl(struct file *file, unsigned int cmd, unsigned long ar | |||
428 | } | 429 | } |
429 | 430 | ||
430 | static const struct file_operations fanotify_fops = { | 431 | static const struct file_operations fanotify_fops = { |
432 | .show_fdinfo = fanotify_show_fdinfo, | ||
431 | .poll = fanotify_poll, | 433 | .poll = fanotify_poll, |
432 | .read = fanotify_read, | 434 | .read = fanotify_read, |
433 | .write = fanotify_write, | 435 | .write = fanotify_write, |
diff --git a/fs/notify/fdinfo.c b/fs/notify/fdinfo.c new file mode 100644 index 000000000000..514c4b81483d --- /dev/null +++ b/fs/notify/fdinfo.c | |||
@@ -0,0 +1,179 @@ | |||
1 | #include <linux/file.h> | ||
2 | #include <linux/fs.h> | ||
3 | #include <linux/fsnotify_backend.h> | ||
4 | #include <linux/idr.h> | ||
5 | #include <linux/init.h> | ||
6 | #include <linux/inotify.h> | ||
7 | #include <linux/fanotify.h> | ||
8 | #include <linux/kernel.h> | ||
9 | #include <linux/namei.h> | ||
10 | #include <linux/sched.h> | ||
11 | #include <linux/types.h> | ||
12 | #include <linux/seq_file.h> | ||
13 | #include <linux/proc_fs.h> | ||
14 | #include <linux/exportfs.h> | ||
15 | |||
16 | #include "inotify/inotify.h" | ||
17 | #include "../fs/mount.h" | ||
18 | |||
19 | #if defined(CONFIG_PROC_FS) | ||
20 | |||
21 | #if defined(CONFIG_INOTIFY_USER) || defined(CONFIG_FANOTIFY) | ||
22 | |||
23 | static int show_fdinfo(struct seq_file *m, struct file *f, | ||
24 | int (*show)(struct seq_file *m, struct fsnotify_mark *mark)) | ||
25 | { | ||
26 | struct fsnotify_group *group = f->private_data; | ||
27 | struct fsnotify_mark *mark; | ||
28 | int ret = 0; | ||
29 | |||
30 | spin_lock(&group->mark_lock); | ||
31 | list_for_each_entry(mark, &group->marks_list, g_list) { | ||
32 | ret = show(m, mark); | ||
33 | if (ret) | ||
34 | break; | ||
35 | } | ||
36 | spin_unlock(&group->mark_lock); | ||
37 | return ret; | ||
38 | } | ||
39 | |||
40 | #if defined(CONFIG_EXPORTFS) | ||
41 | static int show_mark_fhandle(struct seq_file *m, struct inode *inode) | ||
42 | { | ||
43 | struct { | ||
44 | struct file_handle handle; | ||
45 | u8 pad[64]; | ||
46 | } f; | ||
47 | int size, ret, i; | ||
48 | |||
49 | f.handle.handle_bytes = sizeof(f.pad); | ||
50 | size = f.handle.handle_bytes >> 2; | ||
51 | |||
52 | ret = exportfs_encode_inode_fh(inode, (struct fid *)f.handle.f_handle, &size, 0); | ||
53 | if ((ret == 255) || (ret == -ENOSPC)) { | ||
54 | WARN_ONCE(1, "Can't encode file handler for inotify: %d\n", ret); | ||
55 | return 0; | ||
56 | } | ||
57 | |||
58 | f.handle.handle_type = ret; | ||
59 | f.handle.handle_bytes = size * sizeof(u32); | ||
60 | |||
61 | ret = seq_printf(m, "fhandle-bytes:%x fhandle-type:%x f_handle:", | ||
62 | f.handle.handle_bytes, f.handle.handle_type); | ||
63 | |||
64 | for (i = 0; i < f.handle.handle_bytes; i++) | ||
65 | ret |= seq_printf(m, "%02x", (int)f.handle.f_handle[i]); | ||
66 | |||
67 | return ret; | ||
68 | } | ||
69 | #else | ||
70 | static int show_mark_fhandle(struct seq_file *m, struct inode *inode) | ||
71 | { | ||
72 | return 0; | ||
73 | } | ||
74 | #endif | ||
75 | |||
76 | #ifdef CONFIG_INOTIFY_USER | ||
77 | |||
78 | static int inotify_fdinfo(struct seq_file *m, struct fsnotify_mark *mark) | ||
79 | { | ||
80 | struct inotify_inode_mark *inode_mark; | ||
81 | struct inode *inode; | ||
82 | int ret = 0; | ||
83 | |||
84 | if (!(mark->flags & (FSNOTIFY_MARK_FLAG_ALIVE | FSNOTIFY_MARK_FLAG_INODE))) | ||
85 | return 0; | ||
86 | |||
87 | inode_mark = container_of(mark, struct inotify_inode_mark, fsn_mark); | ||
88 | inode = igrab(mark->i.inode); | ||
89 | if (inode) { | ||
90 | ret = seq_printf(m, "inotify wd:%x ino:%lx sdev:%x " | ||
91 | "mask:%x ignored_mask:%x ", | ||
92 | inode_mark->wd, inode->i_ino, | ||
93 | inode->i_sb->s_dev, | ||
94 | mark->mask, mark->ignored_mask); | ||
95 | ret |= show_mark_fhandle(m, inode); | ||
96 | ret |= seq_putc(m, '\n'); | ||
97 | iput(inode); | ||
98 | } | ||
99 | |||
100 | return ret; | ||
101 | } | ||
102 | |||
103 | int inotify_show_fdinfo(struct seq_file *m, struct file *f) | ||
104 | { | ||
105 | return show_fdinfo(m, f, inotify_fdinfo); | ||
106 | } | ||
107 | |||
108 | #endif /* CONFIG_INOTIFY_USER */ | ||
109 | |||
110 | #ifdef CONFIG_FANOTIFY | ||
111 | |||
112 | static int fanotify_fdinfo(struct seq_file *m, struct fsnotify_mark *mark) | ||
113 | { | ||
114 | unsigned int mflags = 0; | ||
115 | struct inode *inode; | ||
116 | int ret = 0; | ||
117 | |||
118 | if (!(mark->flags & FSNOTIFY_MARK_FLAG_ALIVE)) | ||
119 | return 0; | ||
120 | |||
121 | if (mark->flags & FSNOTIFY_MARK_FLAG_IGNORED_SURV_MODIFY) | ||
122 | mflags |= FAN_MARK_IGNORED_SURV_MODIFY; | ||
123 | |||
124 | if (mark->flags & FSNOTIFY_MARK_FLAG_INODE) { | ||
125 | inode = igrab(mark->i.inode); | ||
126 | if (!inode) | ||
127 | goto out; | ||
128 | ret = seq_printf(m, "fanotify ino:%lx sdev:%x " | ||
129 | "mflags:%x mask:%x ignored_mask:%x ", | ||
130 | inode->i_ino, inode->i_sb->s_dev, | ||
131 | mflags, mark->mask, mark->ignored_mask); | ||
132 | ret |= show_mark_fhandle(m, inode); | ||
133 | ret |= seq_putc(m, '\n'); | ||
134 | iput(inode); | ||
135 | } else if (mark->flags & FSNOTIFY_MARK_FLAG_VFSMOUNT) { | ||
136 | struct mount *mnt = real_mount(mark->m.mnt); | ||
137 | |||
138 | ret = seq_printf(m, "fanotify mnt_id:%x mflags:%x mask:%x " | ||
139 | "ignored_mask:%x\n", mnt->mnt_id, mflags, | ||
140 | mark->mask, mark->ignored_mask); | ||
141 | } | ||
142 | out: | ||
143 | return ret; | ||
144 | } | ||
145 | |||
146 | int fanotify_show_fdinfo(struct seq_file *m, struct file *f) | ||
147 | { | ||
148 | struct fsnotify_group *group = f->private_data; | ||
149 | unsigned int flags = 0; | ||
150 | |||
151 | switch (group->priority) { | ||
152 | case FS_PRIO_0: | ||
153 | flags |= FAN_CLASS_NOTIF; | ||
154 | break; | ||
155 | case FS_PRIO_1: | ||
156 | flags |= FAN_CLASS_CONTENT; | ||
157 | break; | ||
158 | case FS_PRIO_2: | ||
159 | flags |= FAN_CLASS_PRE_CONTENT; | ||
160 | break; | ||
161 | } | ||
162 | |||
163 | if (group->max_events == UINT_MAX) | ||
164 | flags |= FAN_UNLIMITED_QUEUE; | ||
165 | |||
166 | if (group->fanotify_data.max_marks == UINT_MAX) | ||
167 | flags |= FAN_UNLIMITED_MARKS; | ||
168 | |||
169 | seq_printf(m, "fanotify flags:%x event-flags:%x\n", | ||
170 | flags, group->fanotify_data.f_flags); | ||
171 | |||
172 | return show_fdinfo(m, f, fanotify_fdinfo); | ||
173 | } | ||
174 | |||
175 | #endif /* CONFIG_FANOTIFY */ | ||
176 | |||
177 | #endif /* CONFIG_INOTIFY_USER || CONFIG_FANOTIFY */ | ||
178 | |||
179 | #endif /* CONFIG_PROC_FS */ | ||
diff --git a/fs/notify/fdinfo.h b/fs/notify/fdinfo.h new file mode 100644 index 000000000000..556afda990e9 --- /dev/null +++ b/fs/notify/fdinfo.h | |||
@@ -0,0 +1,27 @@ | |||
1 | #ifndef __FSNOTIFY_FDINFO_H__ | ||
2 | #define __FSNOTIFY_FDINFO_H__ | ||
3 | |||
4 | #include <linux/errno.h> | ||
5 | #include <linux/proc_fs.h> | ||
6 | |||
7 | struct seq_file; | ||
8 | struct file; | ||
9 | |||
10 | #ifdef CONFIG_PROC_FS | ||
11 | |||
12 | #ifdef CONFIG_INOTIFY_USER | ||
13 | extern int inotify_show_fdinfo(struct seq_file *m, struct file *f); | ||
14 | #endif | ||
15 | |||
16 | #ifdef CONFIG_FANOTIFY | ||
17 | extern int fanotify_show_fdinfo(struct seq_file *m, struct file *f); | ||
18 | #endif | ||
19 | |||
20 | #else /* CONFIG_PROC_FS */ | ||
21 | |||
22 | #define inotify_show_fdinfo NULL | ||
23 | #define fanotify_show_fdinfo NULL | ||
24 | |||
25 | #endif /* CONFIG_PROC_FS */ | ||
26 | |||
27 | #endif /* __FSNOTIFY_FDINFO_H__ */ | ||
diff --git a/fs/notify/inode_mark.c b/fs/notify/inode_mark.c index b13c00ac48eb..f3035691f528 100644 --- a/fs/notify/inode_mark.c +++ b/fs/notify/inode_mark.c | |||
@@ -116,8 +116,9 @@ void fsnotify_clear_inode_marks_by_group(struct fsnotify_group *group) | |||
116 | * given a group and inode, find the mark associated with that combination. | 116 | * given a group and inode, find the mark associated with that combination. |
117 | * if found take a reference to that mark and return it, else return NULL | 117 | * if found take a reference to that mark and return it, else return NULL |
118 | */ | 118 | */ |
119 | struct fsnotify_mark *fsnotify_find_inode_mark_locked(struct fsnotify_group *group, | 119 | static struct fsnotify_mark *fsnotify_find_inode_mark_locked( |
120 | struct inode *inode) | 120 | struct fsnotify_group *group, |
121 | struct inode *inode) | ||
121 | { | 122 | { |
122 | struct fsnotify_mark *mark; | 123 | struct fsnotify_mark *mark; |
123 | struct hlist_node *pos; | 124 | struct hlist_node *pos; |
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c index c311dda054a3..36cb013c7c13 100644 --- a/fs/notify/inotify/inotify_user.c +++ b/fs/notify/inotify/inotify_user.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/wait.h> | 40 | #include <linux/wait.h> |
41 | 41 | ||
42 | #include "inotify.h" | 42 | #include "inotify.h" |
43 | #include "../fdinfo.h" | ||
43 | 44 | ||
44 | #include <asm/ioctls.h> | 45 | #include <asm/ioctls.h> |
45 | 46 | ||
@@ -335,6 +336,7 @@ static long inotify_ioctl(struct file *file, unsigned int cmd, | |||
335 | } | 336 | } |
336 | 337 | ||
337 | static const struct file_operations inotify_fops = { | 338 | static const struct file_operations inotify_fops = { |
339 | .show_fdinfo = inotify_show_fdinfo, | ||
338 | .poll = inotify_poll, | 340 | .poll = inotify_poll, |
339 | .read = inotify_read, | 341 | .read = inotify_read, |
340 | .fasync = inotify_fasync, | 342 | .fasync = inotify_fasync, |
diff --git a/fs/ocfs2/extent_map.c b/fs/ocfs2/extent_map.c index 70b5863a2d64..f487aa343442 100644 --- a/fs/ocfs2/extent_map.c +++ b/fs/ocfs2/extent_map.c | |||
@@ -832,7 +832,7 @@ out: | |||
832 | return ret; | 832 | return ret; |
833 | } | 833 | } |
834 | 834 | ||
835 | int ocfs2_seek_data_hole_offset(struct file *file, loff_t *offset, int origin) | 835 | int ocfs2_seek_data_hole_offset(struct file *file, loff_t *offset, int whence) |
836 | { | 836 | { |
837 | struct inode *inode = file->f_mapping->host; | 837 | struct inode *inode = file->f_mapping->host; |
838 | int ret; | 838 | int ret; |
@@ -843,7 +843,7 @@ int ocfs2_seek_data_hole_offset(struct file *file, loff_t *offset, int origin) | |||
843 | struct buffer_head *di_bh = NULL; | 843 | struct buffer_head *di_bh = NULL; |
844 | struct ocfs2_extent_rec rec; | 844 | struct ocfs2_extent_rec rec; |
845 | 845 | ||
846 | BUG_ON(origin != SEEK_DATA && origin != SEEK_HOLE); | 846 | BUG_ON(whence != SEEK_DATA && whence != SEEK_HOLE); |
847 | 847 | ||
848 | ret = ocfs2_inode_lock(inode, &di_bh, 0); | 848 | ret = ocfs2_inode_lock(inode, &di_bh, 0); |
849 | if (ret) { | 849 | if (ret) { |
@@ -859,7 +859,7 @@ int ocfs2_seek_data_hole_offset(struct file *file, loff_t *offset, int origin) | |||
859 | } | 859 | } |
860 | 860 | ||
861 | if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) { | 861 | if (OCFS2_I(inode)->ip_dyn_features & OCFS2_INLINE_DATA_FL) { |
862 | if (origin == SEEK_HOLE) | 862 | if (whence == SEEK_HOLE) |
863 | *offset = inode->i_size; | 863 | *offset = inode->i_size; |
864 | goto out_unlock; | 864 | goto out_unlock; |
865 | } | 865 | } |
@@ -888,8 +888,8 @@ int ocfs2_seek_data_hole_offset(struct file *file, loff_t *offset, int origin) | |||
888 | is_data = (rec.e_flags & OCFS2_EXT_UNWRITTEN) ? 0 : 1; | 888 | is_data = (rec.e_flags & OCFS2_EXT_UNWRITTEN) ? 0 : 1; |
889 | } | 889 | } |
890 | 890 | ||
891 | if ((!is_data && origin == SEEK_HOLE) || | 891 | if ((!is_data && whence == SEEK_HOLE) || |
892 | (is_data && origin == SEEK_DATA)) { | 892 | (is_data && whence == SEEK_DATA)) { |
893 | if (extoff > *offset) | 893 | if (extoff > *offset) |
894 | *offset = extoff; | 894 | *offset = extoff; |
895 | goto out_unlock; | 895 | goto out_unlock; |
@@ -899,7 +899,7 @@ int ocfs2_seek_data_hole_offset(struct file *file, loff_t *offset, int origin) | |||
899 | cpos += clen; | 899 | cpos += clen; |
900 | } | 900 | } |
901 | 901 | ||
902 | if (origin == SEEK_HOLE) { | 902 | if (whence == SEEK_HOLE) { |
903 | extoff = cpos; | 903 | extoff = cpos; |
904 | extoff <<= cs_bits; | 904 | extoff <<= cs_bits; |
905 | extlen = clen; | 905 | extlen = clen; |
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c index dda089804942..fe492e1a3cfc 100644 --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c | |||
@@ -2637,14 +2637,14 @@ bail: | |||
2637 | } | 2637 | } |
2638 | 2638 | ||
2639 | /* Refer generic_file_llseek_unlocked() */ | 2639 | /* Refer generic_file_llseek_unlocked() */ |
2640 | static loff_t ocfs2_file_llseek(struct file *file, loff_t offset, int origin) | 2640 | static loff_t ocfs2_file_llseek(struct file *file, loff_t offset, int whence) |
2641 | { | 2641 | { |
2642 | struct inode *inode = file->f_mapping->host; | 2642 | struct inode *inode = file->f_mapping->host; |
2643 | int ret = 0; | 2643 | int ret = 0; |
2644 | 2644 | ||
2645 | mutex_lock(&inode->i_mutex); | 2645 | mutex_lock(&inode->i_mutex); |
2646 | 2646 | ||
2647 | switch (origin) { | 2647 | switch (whence) { |
2648 | case SEEK_SET: | 2648 | case SEEK_SET: |
2649 | break; | 2649 | break; |
2650 | case SEEK_END: | 2650 | case SEEK_END: |
@@ -2659,7 +2659,7 @@ static loff_t ocfs2_file_llseek(struct file *file, loff_t offset, int origin) | |||
2659 | break; | 2659 | break; |
2660 | case SEEK_DATA: | 2660 | case SEEK_DATA: |
2661 | case SEEK_HOLE: | 2661 | case SEEK_HOLE: |
2662 | ret = ocfs2_seek_data_hole_offset(file, &offset, origin); | 2662 | ret = ocfs2_seek_data_hole_offset(file, &offset, whence); |
2663 | if (ret) | 2663 | if (ret) |
2664 | goto out; | 2664 | goto out; |
2665 | break; | 2665 | break; |
diff --git a/fs/proc/array.c b/fs/proc/array.c index d66248a1919b..6a91e6ffbcbd 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c | |||
@@ -212,7 +212,7 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns, | |||
212 | group_info = cred->group_info; | 212 | group_info = cred->group_info; |
213 | task_unlock(p); | 213 | task_unlock(p); |
214 | 214 | ||
215 | for (g = 0; g < min(group_info->ngroups, NGROUPS_SMALL); g++) | 215 | for (g = 0; g < group_info->ngroups; g++) |
216 | seq_printf(m, "%d ", | 216 | seq_printf(m, "%d ", |
217 | from_kgid_munged(user_ns, GROUP_AT(group_info, g))); | 217 | from_kgid_munged(user_ns, GROUP_AT(group_info, g))); |
218 | put_cred(cred); | 218 | put_cred(cred); |
@@ -220,7 +220,7 @@ static inline void task_state(struct seq_file *m, struct pid_namespace *ns, | |||
220 | seq_putc(m, '\n'); | 220 | seq_putc(m, '\n'); |
221 | } | 221 | } |
222 | 222 | ||
223 | static void render_sigset_t(struct seq_file *m, const char *header, | 223 | void render_sigset_t(struct seq_file *m, const char *header, |
224 | sigset_t *set) | 224 | sigset_t *set) |
225 | { | 225 | { |
226 | int i; | 226 | int i; |
@@ -308,6 +308,10 @@ static void render_cap_t(struct seq_file *m, const char *header, | |||
308 | seq_putc(m, '\n'); | 308 | seq_putc(m, '\n'); |
309 | } | 309 | } |
310 | 310 | ||
311 | /* Remove non-existent capabilities */ | ||
312 | #define NORM_CAPS(v) (v.cap[CAP_TO_INDEX(CAP_LAST_CAP)] &= \ | ||
313 | CAP_TO_MASK(CAP_LAST_CAP + 1) - 1) | ||
314 | |||
311 | static inline void task_cap(struct seq_file *m, struct task_struct *p) | 315 | static inline void task_cap(struct seq_file *m, struct task_struct *p) |
312 | { | 316 | { |
313 | const struct cred *cred; | 317 | const struct cred *cred; |
@@ -321,12 +325,24 @@ static inline void task_cap(struct seq_file *m, struct task_struct *p) | |||
321 | cap_bset = cred->cap_bset; | 325 | cap_bset = cred->cap_bset; |
322 | rcu_read_unlock(); | 326 | rcu_read_unlock(); |
323 | 327 | ||
328 | NORM_CAPS(cap_inheritable); | ||
329 | NORM_CAPS(cap_permitted); | ||
330 | NORM_CAPS(cap_effective); | ||
331 | NORM_CAPS(cap_bset); | ||
332 | |||
324 | render_cap_t(m, "CapInh:\t", &cap_inheritable); | 333 | render_cap_t(m, "CapInh:\t", &cap_inheritable); |
325 | render_cap_t(m, "CapPrm:\t", &cap_permitted); | 334 | render_cap_t(m, "CapPrm:\t", &cap_permitted); |
326 | render_cap_t(m, "CapEff:\t", &cap_effective); | 335 | render_cap_t(m, "CapEff:\t", &cap_effective); |
327 | render_cap_t(m, "CapBnd:\t", &cap_bset); | 336 | render_cap_t(m, "CapBnd:\t", &cap_bset); |
328 | } | 337 | } |
329 | 338 | ||
339 | static inline void task_seccomp(struct seq_file *m, struct task_struct *p) | ||
340 | { | ||
341 | #ifdef CONFIG_SECCOMP | ||
342 | seq_printf(m, "Seccomp:\t%d\n", p->seccomp.mode); | ||
343 | #endif | ||
344 | } | ||
345 | |||
330 | static inline void task_context_switch_counts(struct seq_file *m, | 346 | static inline void task_context_switch_counts(struct seq_file *m, |
331 | struct task_struct *p) | 347 | struct task_struct *p) |
332 | { | 348 | { |
@@ -360,6 +376,7 @@ int proc_pid_status(struct seq_file *m, struct pid_namespace *ns, | |||
360 | } | 376 | } |
361 | task_sig(m, task); | 377 | task_sig(m, task); |
362 | task_cap(m, task); | 378 | task_cap(m, task); |
379 | task_seccomp(m, task); | ||
363 | task_cpus_allowed(m, task); | 380 | task_cpus_allowed(m, task); |
364 | cpuset_task_status_allowed(m, task); | 381 | cpuset_task_status_allowed(m, task); |
365 | task_context_switch_counts(m, task); | 382 | task_context_switch_counts(m, task); |
diff --git a/fs/proc/fd.c b/fs/proc/fd.c index f28a875f8779..d7a4a28ef630 100644 --- a/fs/proc/fd.c +++ b/fs/proc/fd.c | |||
@@ -50,6 +50,8 @@ static int seq_show(struct seq_file *m, void *v) | |||
50 | if (!ret) { | 50 | if (!ret) { |
51 | seq_printf(m, "pos:\t%lli\nflags:\t0%o\n", | 51 | seq_printf(m, "pos:\t%lli\nflags:\t0%o\n", |
52 | (long long)file->f_pos, f_flags); | 52 | (long long)file->f_pos, f_flags); |
53 | if (file->f_op->show_fdinfo) | ||
54 | ret = file->f_op->show_fdinfo(m, file); | ||
53 | fput(file); | 55 | fput(file); |
54 | } | 56 | } |
55 | 57 | ||
diff --git a/fs/proc/proc_devtree.c b/fs/proc/proc_devtree.c index df7dd08d4391..de20ec480fa0 100644 --- a/fs/proc/proc_devtree.c +++ b/fs/proc/proc_devtree.c | |||
@@ -195,11 +195,7 @@ void proc_device_tree_add_node(struct device_node *np, | |||
195 | set_node_proc_entry(np, de); | 195 | set_node_proc_entry(np, de); |
196 | for (child = NULL; (child = of_get_next_child(np, child));) { | 196 | for (child = NULL; (child = of_get_next_child(np, child));) { |
197 | /* Use everything after the last slash, or the full name */ | 197 | /* Use everything after the last slash, or the full name */ |
198 | p = strrchr(child->full_name, '/'); | 198 | p = kbasename(child->full_name); |
199 | if (!p) | ||
200 | p = child->full_name; | ||
201 | else | ||
202 | ++p; | ||
203 | 199 | ||
204 | if (duplicate_name(de, p)) | 200 | if (duplicate_name(de, p)) |
205 | p = fixup_name(np, de, p); | 201 | p = fixup_name(np, de, p); |
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 48775628abbf..448455b7fd91 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
@@ -526,6 +526,57 @@ static int smaps_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, | |||
526 | return 0; | 526 | return 0; |
527 | } | 527 | } |
528 | 528 | ||
529 | static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma) | ||
530 | { | ||
531 | /* | ||
532 | * Don't forget to update Documentation/ on changes. | ||
533 | */ | ||
534 | static const char mnemonics[BITS_PER_LONG][2] = { | ||
535 | /* | ||
536 | * In case if we meet a flag we don't know about. | ||
537 | */ | ||
538 | [0 ... (BITS_PER_LONG-1)] = "??", | ||
539 | |||
540 | [ilog2(VM_READ)] = "rd", | ||
541 | [ilog2(VM_WRITE)] = "wr", | ||
542 | [ilog2(VM_EXEC)] = "ex", | ||
543 | [ilog2(VM_SHARED)] = "sh", | ||
544 | [ilog2(VM_MAYREAD)] = "mr", | ||
545 | [ilog2(VM_MAYWRITE)] = "mw", | ||
546 | [ilog2(VM_MAYEXEC)] = "me", | ||
547 | [ilog2(VM_MAYSHARE)] = "ms", | ||
548 | [ilog2(VM_GROWSDOWN)] = "gd", | ||
549 | [ilog2(VM_PFNMAP)] = "pf", | ||
550 | [ilog2(VM_DENYWRITE)] = "dw", | ||
551 | [ilog2(VM_LOCKED)] = "lo", | ||
552 | [ilog2(VM_IO)] = "io", | ||
553 | [ilog2(VM_SEQ_READ)] = "sr", | ||
554 | [ilog2(VM_RAND_READ)] = "rr", | ||
555 | [ilog2(VM_DONTCOPY)] = "dc", | ||
556 | [ilog2(VM_DONTEXPAND)] = "de", | ||
557 | [ilog2(VM_ACCOUNT)] = "ac", | ||
558 | [ilog2(VM_NORESERVE)] = "nr", | ||
559 | [ilog2(VM_HUGETLB)] = "ht", | ||
560 | [ilog2(VM_NONLINEAR)] = "nl", | ||
561 | [ilog2(VM_ARCH_1)] = "ar", | ||
562 | [ilog2(VM_DONTDUMP)] = "dd", | ||
563 | [ilog2(VM_MIXEDMAP)] = "mm", | ||
564 | [ilog2(VM_HUGEPAGE)] = "hg", | ||
565 | [ilog2(VM_NOHUGEPAGE)] = "nh", | ||
566 | [ilog2(VM_MERGEABLE)] = "mg", | ||
567 | }; | ||
568 | size_t i; | ||
569 | |||
570 | seq_puts(m, "VmFlags: "); | ||
571 | for (i = 0; i < BITS_PER_LONG; i++) { | ||
572 | if (vma->vm_flags & (1UL << i)) { | ||
573 | seq_printf(m, "%c%c ", | ||
574 | mnemonics[i][0], mnemonics[i][1]); | ||
575 | } | ||
576 | } | ||
577 | seq_putc(m, '\n'); | ||
578 | } | ||
579 | |||
529 | static int show_smap(struct seq_file *m, void *v, int is_pid) | 580 | static int show_smap(struct seq_file *m, void *v, int is_pid) |
530 | { | 581 | { |
531 | struct proc_maps_private *priv = m->private; | 582 | struct proc_maps_private *priv = m->private; |
@@ -581,6 +632,8 @@ static int show_smap(struct seq_file *m, void *v, int is_pid) | |||
581 | seq_printf(m, "Nonlinear: %8lu kB\n", | 632 | seq_printf(m, "Nonlinear: %8lu kB\n", |
582 | mss.nonlinear >> 10); | 633 | mss.nonlinear >> 10); |
583 | 634 | ||
635 | show_smap_vma_flags(m, vma); | ||
636 | |||
584 | if (m->count < m->size) /* vma is copied successfully */ | 637 | if (m->count < m->size) /* vma is copied successfully */ |
585 | m->version = (vma != get_gate_vma(task->mm)) | 638 | m->version = (vma != get_gate_vma(task->mm)) |
586 | ? vma->vm_start : 0; | 639 | ? vma->vm_start : 0; |
diff --git a/fs/pstore/inode.c b/fs/pstore/inode.c index ed1d8c7212da..67de74ca85f4 100644 --- a/fs/pstore/inode.c +++ b/fs/pstore/inode.c | |||
@@ -151,13 +151,13 @@ static int pstore_file_open(struct inode *inode, struct file *file) | |||
151 | return 0; | 151 | return 0; |
152 | } | 152 | } |
153 | 153 | ||
154 | static loff_t pstore_file_llseek(struct file *file, loff_t off, int origin) | 154 | static loff_t pstore_file_llseek(struct file *file, loff_t off, int whence) |
155 | { | 155 | { |
156 | struct seq_file *sf = file->private_data; | 156 | struct seq_file *sf = file->private_data; |
157 | 157 | ||
158 | if (sf->op) | 158 | if (sf->op) |
159 | return seq_lseek(file, off, origin); | 159 | return seq_lseek(file, off, whence); |
160 | return default_llseek(file, off, origin); | 160 | return default_llseek(file, off, whence); |
161 | } | 161 | } |
162 | 162 | ||
163 | static const struct file_operations pstore_file_operations = { | 163 | static const struct file_operations pstore_file_operations = { |
diff --git a/fs/read_write.c b/fs/read_write.c index d06534857e9e..1edaf099ddd7 100644 --- a/fs/read_write.c +++ b/fs/read_write.c | |||
@@ -54,7 +54,7 @@ static loff_t lseek_execute(struct file *file, struct inode *inode, | |||
54 | * generic_file_llseek_size - generic llseek implementation for regular files | 54 | * generic_file_llseek_size - generic llseek implementation for regular files |
55 | * @file: file structure to seek on | 55 | * @file: file structure to seek on |
56 | * @offset: file offset to seek to | 56 | * @offset: file offset to seek to |
57 | * @origin: type of seek | 57 | * @whence: type of seek |
58 | * @size: max size of this file in file system | 58 | * @size: max size of this file in file system |
59 | * @eof: offset used for SEEK_END position | 59 | * @eof: offset used for SEEK_END position |
60 | * | 60 | * |
@@ -67,12 +67,12 @@ static loff_t lseek_execute(struct file *file, struct inode *inode, | |||
67 | * read/writes behave like SEEK_SET against seeks. | 67 | * read/writes behave like SEEK_SET against seeks. |
68 | */ | 68 | */ |
69 | loff_t | 69 | loff_t |
70 | generic_file_llseek_size(struct file *file, loff_t offset, int origin, | 70 | generic_file_llseek_size(struct file *file, loff_t offset, int whence, |
71 | loff_t maxsize, loff_t eof) | 71 | loff_t maxsize, loff_t eof) |
72 | { | 72 | { |
73 | struct inode *inode = file->f_mapping->host; | 73 | struct inode *inode = file->f_mapping->host; |
74 | 74 | ||
75 | switch (origin) { | 75 | switch (whence) { |
76 | case SEEK_END: | 76 | case SEEK_END: |
77 | offset += eof; | 77 | offset += eof; |
78 | break; | 78 | break; |
@@ -122,17 +122,17 @@ EXPORT_SYMBOL(generic_file_llseek_size); | |||
122 | * generic_file_llseek - generic llseek implementation for regular files | 122 | * generic_file_llseek - generic llseek implementation for regular files |
123 | * @file: file structure to seek on | 123 | * @file: file structure to seek on |
124 | * @offset: file offset to seek to | 124 | * @offset: file offset to seek to |
125 | * @origin: type of seek | 125 | * @whence: type of seek |
126 | * | 126 | * |
127 | * This is a generic implemenation of ->llseek useable for all normal local | 127 | * This is a generic implemenation of ->llseek useable for all normal local |
128 | * filesystems. It just updates the file offset to the value specified by | 128 | * filesystems. It just updates the file offset to the value specified by |
129 | * @offset and @origin under i_mutex. | 129 | * @offset and @whence under i_mutex. |
130 | */ | 130 | */ |
131 | loff_t generic_file_llseek(struct file *file, loff_t offset, int origin) | 131 | loff_t generic_file_llseek(struct file *file, loff_t offset, int whence) |
132 | { | 132 | { |
133 | struct inode *inode = file->f_mapping->host; | 133 | struct inode *inode = file->f_mapping->host; |
134 | 134 | ||
135 | return generic_file_llseek_size(file, offset, origin, | 135 | return generic_file_llseek_size(file, offset, whence, |
136 | inode->i_sb->s_maxbytes, | 136 | inode->i_sb->s_maxbytes, |
137 | i_size_read(inode)); | 137 | i_size_read(inode)); |
138 | } | 138 | } |
@@ -142,32 +142,32 @@ EXPORT_SYMBOL(generic_file_llseek); | |||
142 | * noop_llseek - No Operation Performed llseek implementation | 142 | * noop_llseek - No Operation Performed llseek implementation |
143 | * @file: file structure to seek on | 143 | * @file: file structure to seek on |
144 | * @offset: file offset to seek to | 144 | * @offset: file offset to seek to |
145 | * @origin: type of seek | 145 | * @whence: type of seek |
146 | * | 146 | * |
147 | * This is an implementation of ->llseek useable for the rare special case when | 147 | * This is an implementation of ->llseek useable for the rare special case when |
148 | * userspace expects the seek to succeed but the (device) file is actually not | 148 | * userspace expects the seek to succeed but the (device) file is actually not |
149 | * able to perform the seek. In this case you use noop_llseek() instead of | 149 | * able to perform the seek. In this case you use noop_llseek() instead of |
150 | * falling back to the default implementation of ->llseek. | 150 | * falling back to the default implementation of ->llseek. |
151 | */ | 151 | */ |
152 | loff_t noop_llseek(struct file *file, loff_t offset, int origin) | 152 | loff_t noop_llseek(struct file *file, loff_t offset, int whence) |
153 | { | 153 | { |
154 | return file->f_pos; | 154 | return file->f_pos; |
155 | } | 155 | } |
156 | EXPORT_SYMBOL(noop_llseek); | 156 | EXPORT_SYMBOL(noop_llseek); |
157 | 157 | ||
158 | loff_t no_llseek(struct file *file, loff_t offset, int origin) | 158 | loff_t no_llseek(struct file *file, loff_t offset, int whence) |
159 | { | 159 | { |
160 | return -ESPIPE; | 160 | return -ESPIPE; |
161 | } | 161 | } |
162 | EXPORT_SYMBOL(no_llseek); | 162 | EXPORT_SYMBOL(no_llseek); |
163 | 163 | ||
164 | loff_t default_llseek(struct file *file, loff_t offset, int origin) | 164 | loff_t default_llseek(struct file *file, loff_t offset, int whence) |
165 | { | 165 | { |
166 | struct inode *inode = file->f_path.dentry->d_inode; | 166 | struct inode *inode = file->f_path.dentry->d_inode; |
167 | loff_t retval; | 167 | loff_t retval; |
168 | 168 | ||
169 | mutex_lock(&inode->i_mutex); | 169 | mutex_lock(&inode->i_mutex); |
170 | switch (origin) { | 170 | switch (whence) { |
171 | case SEEK_END: | 171 | case SEEK_END: |
172 | offset += i_size_read(inode); | 172 | offset += i_size_read(inode); |
173 | break; | 173 | break; |
@@ -216,7 +216,7 @@ out: | |||
216 | } | 216 | } |
217 | EXPORT_SYMBOL(default_llseek); | 217 | EXPORT_SYMBOL(default_llseek); |
218 | 218 | ||
219 | loff_t vfs_llseek(struct file *file, loff_t offset, int origin) | 219 | loff_t vfs_llseek(struct file *file, loff_t offset, int whence) |
220 | { | 220 | { |
221 | loff_t (*fn)(struct file *, loff_t, int); | 221 | loff_t (*fn)(struct file *, loff_t, int); |
222 | 222 | ||
@@ -225,11 +225,11 @@ loff_t vfs_llseek(struct file *file, loff_t offset, int origin) | |||
225 | if (file->f_op && file->f_op->llseek) | 225 | if (file->f_op && file->f_op->llseek) |
226 | fn = file->f_op->llseek; | 226 | fn = file->f_op->llseek; |
227 | } | 227 | } |
228 | return fn(file, offset, origin); | 228 | return fn(file, offset, whence); |
229 | } | 229 | } |
230 | EXPORT_SYMBOL(vfs_llseek); | 230 | EXPORT_SYMBOL(vfs_llseek); |
231 | 231 | ||
232 | SYSCALL_DEFINE3(lseek, unsigned int, fd, off_t, offset, unsigned int, origin) | 232 | SYSCALL_DEFINE3(lseek, unsigned int, fd, off_t, offset, unsigned int, whence) |
233 | { | 233 | { |
234 | off_t retval; | 234 | off_t retval; |
235 | struct fd f = fdget(fd); | 235 | struct fd f = fdget(fd); |
@@ -237,8 +237,8 @@ SYSCALL_DEFINE3(lseek, unsigned int, fd, off_t, offset, unsigned int, origin) | |||
237 | return -EBADF; | 237 | return -EBADF; |
238 | 238 | ||
239 | retval = -EINVAL; | 239 | retval = -EINVAL; |
240 | if (origin <= SEEK_MAX) { | 240 | if (whence <= SEEK_MAX) { |
241 | loff_t res = vfs_llseek(f.file, offset, origin); | 241 | loff_t res = vfs_llseek(f.file, offset, whence); |
242 | retval = res; | 242 | retval = res; |
243 | if (res != (loff_t)retval) | 243 | if (res != (loff_t)retval) |
244 | retval = -EOVERFLOW; /* LFS: should only happen on 32 bit platforms */ | 244 | retval = -EOVERFLOW; /* LFS: should only happen on 32 bit platforms */ |
@@ -250,7 +250,7 @@ SYSCALL_DEFINE3(lseek, unsigned int, fd, off_t, offset, unsigned int, origin) | |||
250 | #ifdef __ARCH_WANT_SYS_LLSEEK | 250 | #ifdef __ARCH_WANT_SYS_LLSEEK |
251 | SYSCALL_DEFINE5(llseek, unsigned int, fd, unsigned long, offset_high, | 251 | SYSCALL_DEFINE5(llseek, unsigned int, fd, unsigned long, offset_high, |
252 | unsigned long, offset_low, loff_t __user *, result, | 252 | unsigned long, offset_low, loff_t __user *, result, |
253 | unsigned int, origin) | 253 | unsigned int, whence) |
254 | { | 254 | { |
255 | int retval; | 255 | int retval; |
256 | struct fd f = fdget(fd); | 256 | struct fd f = fdget(fd); |
@@ -260,11 +260,11 @@ SYSCALL_DEFINE5(llseek, unsigned int, fd, unsigned long, offset_high, | |||
260 | return -EBADF; | 260 | return -EBADF; |
261 | 261 | ||
262 | retval = -EINVAL; | 262 | retval = -EINVAL; |
263 | if (origin > SEEK_MAX) | 263 | if (whence > SEEK_MAX) |
264 | goto out_putf; | 264 | goto out_putf; |
265 | 265 | ||
266 | offset = vfs_llseek(f.file, ((loff_t) offset_high << 32) | offset_low, | 266 | offset = vfs_llseek(f.file, ((loff_t) offset_high << 32) | offset_low, |
267 | origin); | 267 | whence); |
268 | 268 | ||
269 | retval = (int)offset; | 269 | retval = (int)offset; |
270 | if (offset >= 0) { | 270 | if (offset >= 0) { |
diff --git a/fs/seq_file.c b/fs/seq_file.c index 99dffab4c4e4..9d863fb501f9 100644 --- a/fs/seq_file.c +++ b/fs/seq_file.c | |||
@@ -300,14 +300,14 @@ EXPORT_SYMBOL(seq_read); | |||
300 | * | 300 | * |
301 | * Ready-made ->f_op->llseek() | 301 | * Ready-made ->f_op->llseek() |
302 | */ | 302 | */ |
303 | loff_t seq_lseek(struct file *file, loff_t offset, int origin) | 303 | loff_t seq_lseek(struct file *file, loff_t offset, int whence) |
304 | { | 304 | { |
305 | struct seq_file *m = file->private_data; | 305 | struct seq_file *m = file->private_data; |
306 | loff_t retval = -EINVAL; | 306 | loff_t retval = -EINVAL; |
307 | 307 | ||
308 | mutex_lock(&m->lock); | 308 | mutex_lock(&m->lock); |
309 | m->version = file->f_version; | 309 | m->version = file->f_version; |
310 | switch (origin) { | 310 | switch (whence) { |
311 | case 1: | 311 | case 1: |
312 | offset += file->f_pos; | 312 | offset += file->f_pos; |
313 | case 0: | 313 | case 0: |
diff --git a/fs/signalfd.c b/fs/signalfd.c index 8bee4e570911..b53486961735 100644 --- a/fs/signalfd.c +++ b/fs/signalfd.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/anon_inodes.h> | 29 | #include <linux/anon_inodes.h> |
30 | #include <linux/signalfd.h> | 30 | #include <linux/signalfd.h> |
31 | #include <linux/syscalls.h> | 31 | #include <linux/syscalls.h> |
32 | #include <linux/proc_fs.h> | ||
32 | 33 | ||
33 | void signalfd_cleanup(struct sighand_struct *sighand) | 34 | void signalfd_cleanup(struct sighand_struct *sighand) |
34 | { | 35 | { |
@@ -227,7 +228,24 @@ static ssize_t signalfd_read(struct file *file, char __user *buf, size_t count, | |||
227 | return total ? total: ret; | 228 | return total ? total: ret; |
228 | } | 229 | } |
229 | 230 | ||
231 | #ifdef CONFIG_PROC_FS | ||
232 | static int signalfd_show_fdinfo(struct seq_file *m, struct file *f) | ||
233 | { | ||
234 | struct signalfd_ctx *ctx = f->private_data; | ||
235 | sigset_t sigmask; | ||
236 | |||
237 | sigmask = ctx->sigmask; | ||
238 | signotset(&sigmask); | ||
239 | render_sigset_t(m, "sigmask:\t", &sigmask); | ||
240 | |||
241 | return 0; | ||
242 | } | ||
243 | #endif | ||
244 | |||
230 | static const struct file_operations signalfd_fops = { | 245 | static const struct file_operations signalfd_fops = { |
246 | #ifdef CONFIG_PROC_FS | ||
247 | .show_fdinfo = signalfd_show_fdinfo, | ||
248 | #endif | ||
231 | .release = signalfd_release, | 249 | .release = signalfd_release, |
232 | .poll = signalfd_poll, | 250 | .poll = signalfd_poll, |
233 | .read = signalfd_read, | 251 | .read = signalfd_read, |
diff --git a/fs/ubifs/debug.c b/fs/ubifs/debug.c index 62911637e12f..12817ffc7345 100644 --- a/fs/ubifs/debug.c +++ b/fs/ubifs/debug.c | |||
@@ -2560,7 +2560,7 @@ static int power_cut_emulated(struct ubifs_info *c, int lnum, int write) | |||
2560 | static int corrupt_data(const struct ubifs_info *c, const void *buf, | 2560 | static int corrupt_data(const struct ubifs_info *c, const void *buf, |
2561 | unsigned int len) | 2561 | unsigned int len) |
2562 | { | 2562 | { |
2563 | unsigned int from, to, i, ffs = chance(1, 2); | 2563 | unsigned int from, to, ffs = chance(1, 2); |
2564 | unsigned char *p = (void *)buf; | 2564 | unsigned char *p = (void *)buf; |
2565 | 2565 | ||
2566 | from = random32() % (len + 1); | 2566 | from = random32() % (len + 1); |
@@ -2571,11 +2571,9 @@ static int corrupt_data(const struct ubifs_info *c, const void *buf, | |||
2571 | ffs ? "0xFFs" : "random data"); | 2571 | ffs ? "0xFFs" : "random data"); |
2572 | 2572 | ||
2573 | if (ffs) | 2573 | if (ffs) |
2574 | for (i = from; i < to; i++) | 2574 | memset(p + from, 0xFF, to - from); |
2575 | p[i] = 0xFF; | ||
2576 | else | 2575 | else |
2577 | for (i = from; i < to; i++) | 2576 | prandom_bytes(p + from, to - from); |
2578 | p[i] = random32() % 0x100; | ||
2579 | 2577 | ||
2580 | return to; | 2578 | return to; |
2581 | } | 2579 | } |
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c index e271fba1651b..8a574776a493 100644 --- a/fs/ubifs/dir.c +++ b/fs/ubifs/dir.c | |||
@@ -453,11 +453,11 @@ out: | |||
453 | } | 453 | } |
454 | 454 | ||
455 | /* If a directory is seeked, we have to free saved readdir() state */ | 455 | /* If a directory is seeked, we have to free saved readdir() state */ |
456 | static loff_t ubifs_dir_llseek(struct file *file, loff_t offset, int origin) | 456 | static loff_t ubifs_dir_llseek(struct file *file, loff_t offset, int whence) |
457 | { | 457 | { |
458 | kfree(file->private_data); | 458 | kfree(file->private_data); |
459 | file->private_data = NULL; | 459 | file->private_data = NULL; |
460 | return generic_file_llseek(file, offset, origin); | 460 | return generic_file_llseek(file, offset, whence); |
461 | } | 461 | } |
462 | 462 | ||
463 | /* Free saved readdir() state when the directory is closed */ | 463 | /* Free saved readdir() state when the directory is closed */ |