diff options
author | Jeremy Erickson <jerickso@cs.unc.edu> | 2014-04-18 17:06:00 -0400 |
---|---|---|
committer | Jeremy Erickson <jerickso@cs.unc.edu> | 2014-04-18 17:06:00 -0400 |
commit | a215aa7b9ab3759c047201199fba64d3042d7f13 (patch) | |
tree | bca37493d9b2233450e6d3ffced1261d0e4f71fe /fs | |
parent | d31199a77ef606f1d06894385f1852181ba6136b (diff) |
Update 2.6.36 to 2.6.36.4wip-dissipation2-jerickso
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bio.c | 23 | ||||
-rw-r--r-- | fs/cifs/cifsproto.h | 3 | ||||
-rw-r--r-- | fs/cifs/dir.c | 12 | ||||
-rw-r--r-- | fs/cifs/dns_resolve.c | 2 | ||||
-rw-r--r-- | fs/cifs/file.c | 4 | ||||
-rw-r--r-- | fs/cifs/inode.c | 12 | ||||
-rw-r--r-- | fs/compat.c | 28 | ||||
-rw-r--r-- | fs/direct-io.c | 10 | ||||
-rw-r--r-- | fs/ecryptfs/inode.c | 11 | ||||
-rw-r--r-- | fs/exec.c | 41 | ||||
-rw-r--r-- | fs/ext4/inode.c | 1 | ||||
-rw-r--r-- | fs/ext4/super.c | 1 | ||||
-rw-r--r-- | fs/fuse/file.c | 82 | ||||
-rw-r--r-- | fs/hostfs/hostfs.h | 3 | ||||
-rw-r--r-- | fs/hostfs/hostfs_kern.c | 2 | ||||
-rw-r--r-- | fs/hostfs/hostfs_user.c | 9 | ||||
-rw-r--r-- | fs/nfs/delegation.c | 6 | ||||
-rw-r--r-- | fs/nfs/direct.c | 36 | ||||
-rw-r--r-- | fs/nfs/file.c | 19 | ||||
-rw-r--r-- | fs/nfs/mount_clnt.c | 4 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 9 | ||||
-rw-r--r-- | fs/nfs/nfs4state.c | 16 | ||||
-rw-r--r-- | fs/nfs/pagelist.c | 8 | ||||
-rw-r--r-- | fs/nfsd/nfs3xdr.c | 6 | ||||
-rw-r--r-- | fs/nfsd/xdr4.h | 21 | ||||
-rw-r--r-- | fs/nilfs2/super.c | 3 | ||||
-rw-r--r-- | fs/notify/inotify/inotify_user.c | 1 | ||||
-rw-r--r-- | fs/pipe.c | 16 | ||||
-rw-r--r-- | fs/proc/base.c | 2 | ||||
-rw-r--r-- | fs/proc/kcore.c | 2 | ||||
-rw-r--r-- | fs/reiserfs/ioctl.c | 7 | ||||
-rw-r--r-- | fs/reiserfs/xattr_acl.c | 6 | ||||
-rw-r--r-- | fs/splice.c | 24 |
33 files changed, 289 insertions, 141 deletions
@@ -370,6 +370,9 @@ struct bio *bio_kmalloc(gfp_t gfp_mask, int nr_iovecs) | |||
370 | { | 370 | { |
371 | struct bio *bio; | 371 | struct bio *bio; |
372 | 372 | ||
373 | if (nr_iovecs > UIO_MAXIOV) | ||
374 | return NULL; | ||
375 | |||
373 | bio = kmalloc(sizeof(struct bio) + nr_iovecs * sizeof(struct bio_vec), | 376 | bio = kmalloc(sizeof(struct bio) + nr_iovecs * sizeof(struct bio_vec), |
374 | gfp_mask); | 377 | gfp_mask); |
375 | if (unlikely(!bio)) | 378 | if (unlikely(!bio)) |
@@ -697,8 +700,12 @@ static void bio_free_map_data(struct bio_map_data *bmd) | |||
697 | static struct bio_map_data *bio_alloc_map_data(int nr_segs, int iov_count, | 700 | static struct bio_map_data *bio_alloc_map_data(int nr_segs, int iov_count, |
698 | gfp_t gfp_mask) | 701 | gfp_t gfp_mask) |
699 | { | 702 | { |
700 | struct bio_map_data *bmd = kmalloc(sizeof(*bmd), gfp_mask); | 703 | struct bio_map_data *bmd; |
701 | 704 | ||
705 | if (iov_count > UIO_MAXIOV) | ||
706 | return NULL; | ||
707 | |||
708 | bmd = kmalloc(sizeof(*bmd), gfp_mask); | ||
702 | if (!bmd) | 709 | if (!bmd) |
703 | return NULL; | 710 | return NULL; |
704 | 711 | ||
@@ -827,6 +834,12 @@ struct bio *bio_copy_user_iov(struct request_queue *q, | |||
827 | end = (uaddr + iov[i].iov_len + PAGE_SIZE - 1) >> PAGE_SHIFT; | 834 | end = (uaddr + iov[i].iov_len + PAGE_SIZE - 1) >> PAGE_SHIFT; |
828 | start = uaddr >> PAGE_SHIFT; | 835 | start = uaddr >> PAGE_SHIFT; |
829 | 836 | ||
837 | /* | ||
838 | * Overflow, abort | ||
839 | */ | ||
840 | if (end < start) | ||
841 | return ERR_PTR(-EINVAL); | ||
842 | |||
830 | nr_pages += end - start; | 843 | nr_pages += end - start; |
831 | len += iov[i].iov_len; | 844 | len += iov[i].iov_len; |
832 | } | 845 | } |
@@ -955,6 +968,12 @@ static struct bio *__bio_map_user_iov(struct request_queue *q, | |||
955 | unsigned long end = (uaddr + len + PAGE_SIZE - 1) >> PAGE_SHIFT; | 968 | unsigned long end = (uaddr + len + PAGE_SIZE - 1) >> PAGE_SHIFT; |
956 | unsigned long start = uaddr >> PAGE_SHIFT; | 969 | unsigned long start = uaddr >> PAGE_SHIFT; |
957 | 970 | ||
971 | /* | ||
972 | * Overflow, abort | ||
973 | */ | ||
974 | if (end < start) | ||
975 | return ERR_PTR(-EINVAL); | ||
976 | |||
958 | nr_pages += end - start; | 977 | nr_pages += end - start; |
959 | /* | 978 | /* |
960 | * buffer must be aligned to at least hardsector size for now | 979 | * buffer must be aligned to at least hardsector size for now |
@@ -982,7 +1001,7 @@ static struct bio *__bio_map_user_iov(struct request_queue *q, | |||
982 | unsigned long start = uaddr >> PAGE_SHIFT; | 1001 | unsigned long start = uaddr >> PAGE_SHIFT; |
983 | const int local_nr_pages = end - start; | 1002 | const int local_nr_pages = end - start; |
984 | const int page_limit = cur_page + local_nr_pages; | 1003 | const int page_limit = cur_page + local_nr_pages; |
985 | 1004 | ||
986 | ret = get_user_pages_fast(uaddr, local_nr_pages, | 1005 | ret = get_user_pages_fast(uaddr, local_nr_pages, |
987 | write_to_vm, &pages[cur_page]); | 1006 | write_to_vm, &pages[cur_page]); |
988 | if (ret < local_nr_pages) { | 1007 | if (ret < local_nr_pages) { |
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h index 1d60c655e3e0..f110e0e7e947 100644 --- a/fs/cifs/cifsproto.h +++ b/fs/cifs/cifsproto.h | |||
@@ -107,7 +107,8 @@ extern struct timespec cnvrtDosUnixTm(__le16 le_date, __le16 le_time, | |||
107 | 107 | ||
108 | extern struct cifsFileInfo *cifs_new_fileinfo(struct inode *newinode, | 108 | extern struct cifsFileInfo *cifs_new_fileinfo(struct inode *newinode, |
109 | __u16 fileHandle, struct file *file, | 109 | __u16 fileHandle, struct file *file, |
110 | struct vfsmount *mnt, unsigned int oflags); | 110 | struct vfsmount *mnt, unsigned int oflags, |
111 | __u32 oplock); | ||
111 | extern int cifs_posix_open(char *full_path, struct inode **pinode, | 112 | extern int cifs_posix_open(char *full_path, struct inode **pinode, |
112 | struct super_block *sb, | 113 | struct super_block *sb, |
113 | int mode, int oflags, | 114 | int mode, int oflags, |
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index f9ed0751cc12..0f947bf73f8e 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
@@ -132,9 +132,9 @@ cifs_bp_rename_retry: | |||
132 | 132 | ||
133 | struct cifsFileInfo * | 133 | struct cifsFileInfo * |
134 | cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle, | 134 | cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle, |
135 | struct file *file, struct vfsmount *mnt, unsigned int oflags) | 135 | struct file *file, struct vfsmount *mnt, unsigned int oflags, |
136 | __u32 oplock) | ||
136 | { | 137 | { |
137 | int oplock = 0; | ||
138 | struct cifsFileInfo *pCifsFile; | 138 | struct cifsFileInfo *pCifsFile; |
139 | struct cifsInodeInfo *pCifsInode; | 139 | struct cifsInodeInfo *pCifsInode; |
140 | struct cifs_sb_info *cifs_sb = CIFS_SB(mnt->mnt_sb); | 140 | struct cifs_sb_info *cifs_sb = CIFS_SB(mnt->mnt_sb); |
@@ -143,9 +143,6 @@ cifs_new_fileinfo(struct inode *newinode, __u16 fileHandle, | |||
143 | if (pCifsFile == NULL) | 143 | if (pCifsFile == NULL) |
144 | return pCifsFile; | 144 | return pCifsFile; |
145 | 145 | ||
146 | if (oplockEnabled) | ||
147 | oplock = REQ_OPLOCK; | ||
148 | |||
149 | pCifsFile->netfid = fileHandle; | 146 | pCifsFile->netfid = fileHandle; |
150 | pCifsFile->pid = current->tgid; | 147 | pCifsFile->pid = current->tgid; |
151 | pCifsFile->pInode = igrab(newinode); | 148 | pCifsFile->pInode = igrab(newinode); |
@@ -468,7 +465,7 @@ cifs_create_set_dentry: | |||
468 | } | 465 | } |
469 | 466 | ||
470 | pfile_info = cifs_new_fileinfo(newinode, fileHandle, filp, | 467 | pfile_info = cifs_new_fileinfo(newinode, fileHandle, filp, |
471 | nd->path.mnt, oflags); | 468 | nd->path.mnt, oflags, oplock); |
472 | if (pfile_info == NULL) { | 469 | if (pfile_info == NULL) { |
473 | fput(filp); | 470 | fput(filp); |
474 | CIFSSMBClose(xid, tcon, fileHandle); | 471 | CIFSSMBClose(xid, tcon, fileHandle); |
@@ -729,7 +726,8 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, | |||
729 | 726 | ||
730 | cfile = cifs_new_fileinfo(newInode, fileHandle, filp, | 727 | cfile = cifs_new_fileinfo(newInode, fileHandle, filp, |
731 | nd->path.mnt, | 728 | nd->path.mnt, |
732 | nd->intent.open.flags); | 729 | nd->intent.open.flags, |
730 | oplock); | ||
733 | if (cfile == NULL) { | 731 | if (cfile == NULL) { |
734 | fput(filp); | 732 | fput(filp); |
735 | CIFSSMBClose(xid, pTcon, fileHandle); | 733 | CIFSSMBClose(xid, pTcon, fileHandle); |
diff --git a/fs/cifs/dns_resolve.c b/fs/cifs/dns_resolve.c index 0eb87026cad3..548f06230a6d 100644 --- a/fs/cifs/dns_resolve.c +++ b/fs/cifs/dns_resolve.c | |||
@@ -66,7 +66,7 @@ dns_resolve_server_name_to_ip(const char *unc, char **ip_addr) | |||
66 | /* Search for server name delimiter */ | 66 | /* Search for server name delimiter */ |
67 | sep = memchr(hostname, '\\', len); | 67 | sep = memchr(hostname, '\\', len); |
68 | if (sep) | 68 | if (sep) |
69 | len = sep - unc; | 69 | len = sep - hostname; |
70 | else | 70 | else |
71 | cFYI(1, "%s: probably server name is whole unc: %s", | 71 | cFYI(1, "%s: probably server name is whole unc: %s", |
72 | __func__, unc); | 72 | __func__, unc); |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index de748c652d11..681761c3e90c 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -277,7 +277,7 @@ int cifs_open(struct inode *inode, struct file *file) | |||
277 | 277 | ||
278 | pCifsFile = cifs_new_fileinfo(inode, netfid, file, | 278 | pCifsFile = cifs_new_fileinfo(inode, netfid, file, |
279 | file->f_path.mnt, | 279 | file->f_path.mnt, |
280 | oflags); | 280 | oflags, oplock); |
281 | if (pCifsFile == NULL) { | 281 | if (pCifsFile == NULL) { |
282 | CIFSSMBClose(xid, tcon, netfid); | 282 | CIFSSMBClose(xid, tcon, netfid); |
283 | rc = -ENOMEM; | 283 | rc = -ENOMEM; |
@@ -370,7 +370,7 @@ int cifs_open(struct inode *inode, struct file *file) | |||
370 | goto out; | 370 | goto out; |
371 | 371 | ||
372 | pCifsFile = cifs_new_fileinfo(inode, netfid, file, file->f_path.mnt, | 372 | pCifsFile = cifs_new_fileinfo(inode, netfid, file, file->f_path.mnt, |
373 | file->f_flags); | 373 | file->f_flags, oplock); |
374 | if (pCifsFile == NULL) { | 374 | if (pCifsFile == NULL) { |
375 | rc = -ENOMEM; | 375 | rc = -ENOMEM; |
376 | goto out; | 376 | goto out; |
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 53cce8cc2224..00d1ff339ae6 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -835,8 +835,10 @@ struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino) | |||
835 | rc = cifs_get_inode_info(&inode, full_path, NULL, sb, | 835 | rc = cifs_get_inode_info(&inode, full_path, NULL, sb, |
836 | xid, NULL); | 836 | xid, NULL); |
837 | 837 | ||
838 | if (!inode) | 838 | if (!inode) { |
839 | return ERR_PTR(rc); | 839 | inode = ERR_PTR(rc); |
840 | goto out; | ||
841 | } | ||
840 | 842 | ||
841 | #ifdef CONFIG_CIFS_FSCACHE | 843 | #ifdef CONFIG_CIFS_FSCACHE |
842 | /* populate tcon->resource_id */ | 844 | /* populate tcon->resource_id */ |
@@ -852,13 +854,11 @@ struct inode *cifs_root_iget(struct super_block *sb, unsigned long ino) | |||
852 | inode->i_uid = cifs_sb->mnt_uid; | 854 | inode->i_uid = cifs_sb->mnt_uid; |
853 | inode->i_gid = cifs_sb->mnt_gid; | 855 | inode->i_gid = cifs_sb->mnt_gid; |
854 | } else if (rc) { | 856 | } else if (rc) { |
855 | kfree(full_path); | ||
856 | _FreeXid(xid); | ||
857 | iget_failed(inode); | 857 | iget_failed(inode); |
858 | return ERR_PTR(rc); | 858 | inode = ERR_PTR(rc); |
859 | } | 859 | } |
860 | 860 | ||
861 | 861 | out: | |
862 | kfree(full_path); | 862 | kfree(full_path); |
863 | /* can not call macro FreeXid here since in a void func | 863 | /* can not call macro FreeXid here since in a void func |
864 | * TODO: This is no longer true | 864 | * TODO: This is no longer true |
diff --git a/fs/compat.c b/fs/compat.c index 0644a154672b..8b41dcdcdc67 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -1378,6 +1378,10 @@ static int compat_count(compat_uptr_t __user *argv, int max) | |||
1378 | argv++; | 1378 | argv++; |
1379 | if (i++ >= max) | 1379 | if (i++ >= max) |
1380 | return -E2BIG; | 1380 | return -E2BIG; |
1381 | |||
1382 | if (fatal_signal_pending(current)) | ||
1383 | return -ERESTARTNOHAND; | ||
1384 | cond_resched(); | ||
1381 | } | 1385 | } |
1382 | } | 1386 | } |
1383 | return i; | 1387 | return i; |
@@ -1419,6 +1423,12 @@ static int compat_copy_strings(int argc, compat_uptr_t __user *argv, | |||
1419 | while (len > 0) { | 1423 | while (len > 0) { |
1420 | int offset, bytes_to_copy; | 1424 | int offset, bytes_to_copy; |
1421 | 1425 | ||
1426 | if (fatal_signal_pending(current)) { | ||
1427 | ret = -ERESTARTNOHAND; | ||
1428 | goto out; | ||
1429 | } | ||
1430 | cond_resched(); | ||
1431 | |||
1422 | offset = pos % PAGE_SIZE; | 1432 | offset = pos % PAGE_SIZE; |
1423 | if (offset == 0) | 1433 | if (offset == 0) |
1424 | offset = PAGE_SIZE; | 1434 | offset = PAGE_SIZE; |
@@ -1435,18 +1445,8 @@ static int compat_copy_strings(int argc, compat_uptr_t __user *argv, | |||
1435 | if (!kmapped_page || kpos != (pos & PAGE_MASK)) { | 1445 | if (!kmapped_page || kpos != (pos & PAGE_MASK)) { |
1436 | struct page *page; | 1446 | struct page *page; |
1437 | 1447 | ||
1438 | #ifdef CONFIG_STACK_GROWSUP | 1448 | page = get_arg_page(bprm, pos, 1); |
1439 | ret = expand_stack_downwards(bprm->vma, pos); | 1449 | if (!page) { |
1440 | if (ret < 0) { | ||
1441 | /* We've exceed the stack rlimit. */ | ||
1442 | ret = -E2BIG; | ||
1443 | goto out; | ||
1444 | } | ||
1445 | #endif | ||
1446 | ret = get_user_pages(current, bprm->mm, pos, | ||
1447 | 1, 1, 1, &page, NULL); | ||
1448 | if (ret <= 0) { | ||
1449 | /* We've exceed the stack rlimit. */ | ||
1450 | ret = -E2BIG; | 1450 | ret = -E2BIG; |
1451 | goto out; | 1451 | goto out; |
1452 | } | 1452 | } |
@@ -1567,8 +1567,10 @@ int compat_do_execve(char * filename, | |||
1567 | return retval; | 1567 | return retval; |
1568 | 1568 | ||
1569 | out: | 1569 | out: |
1570 | if (bprm->mm) | 1570 | if (bprm->mm) { |
1571 | acct_arg_size(bprm, 0); | ||
1571 | mmput(bprm->mm); | 1572 | mmput(bprm->mm); |
1573 | } | ||
1572 | 1574 | ||
1573 | out_file: | 1575 | out_file: |
1574 | if (bprm->file) { | 1576 | if (bprm->file) { |
diff --git a/fs/direct-io.c b/fs/direct-io.c index 48d74c7391d1..92030e371a94 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c | |||
@@ -325,12 +325,16 @@ void dio_end_io(struct bio *bio, int error) | |||
325 | } | 325 | } |
326 | EXPORT_SYMBOL_GPL(dio_end_io); | 326 | EXPORT_SYMBOL_GPL(dio_end_io); |
327 | 327 | ||
328 | static int | 328 | static void |
329 | dio_bio_alloc(struct dio *dio, struct block_device *bdev, | 329 | dio_bio_alloc(struct dio *dio, struct block_device *bdev, |
330 | sector_t first_sector, int nr_vecs) | 330 | sector_t first_sector, int nr_vecs) |
331 | { | 331 | { |
332 | struct bio *bio; | 332 | struct bio *bio; |
333 | 333 | ||
334 | /* | ||
335 | * bio_alloc() is guaranteed to return a bio when called with | ||
336 | * __GFP_WAIT and we request a valid number of vectors. | ||
337 | */ | ||
334 | bio = bio_alloc(GFP_KERNEL, nr_vecs); | 338 | bio = bio_alloc(GFP_KERNEL, nr_vecs); |
335 | 339 | ||
336 | bio->bi_bdev = bdev; | 340 | bio->bi_bdev = bdev; |
@@ -342,7 +346,6 @@ dio_bio_alloc(struct dio *dio, struct block_device *bdev, | |||
342 | 346 | ||
343 | dio->bio = bio; | 347 | dio->bio = bio; |
344 | dio->logical_offset_in_bio = dio->cur_page_fs_offset; | 348 | dio->logical_offset_in_bio = dio->cur_page_fs_offset; |
345 | return 0; | ||
346 | } | 349 | } |
347 | 350 | ||
348 | /* | 351 | /* |
@@ -583,8 +586,9 @@ static int dio_new_bio(struct dio *dio, sector_t start_sector) | |||
583 | goto out; | 586 | goto out; |
584 | sector = start_sector << (dio->blkbits - 9); | 587 | sector = start_sector << (dio->blkbits - 9); |
585 | nr_pages = min(dio->pages_in_io, bio_get_nr_vecs(dio->map_bh.b_bdev)); | 588 | nr_pages = min(dio->pages_in_io, bio_get_nr_vecs(dio->map_bh.b_bdev)); |
589 | nr_pages = min(nr_pages, BIO_MAX_PAGES); | ||
586 | BUG_ON(nr_pages <= 0); | 590 | BUG_ON(nr_pages <= 0); |
587 | ret = dio_bio_alloc(dio, dio->map_bh.b_bdev, sector, nr_pages); | 591 | dio_bio_alloc(dio, dio->map_bh.b_bdev, sector, nr_pages); |
588 | dio->boundary = 0; | 592 | dio->boundary = 0; |
589 | out: | 593 | out: |
590 | return ret; | 594 | return ret; |
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index 3fbc94203380..9d1a22d62765 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/crypto.h> | 32 | #include <linux/crypto.h> |
33 | #include <linux/fs_stack.h> | 33 | #include <linux/fs_stack.h> |
34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
35 | #include <linux/xattr.h> | ||
35 | #include <asm/unaligned.h> | 36 | #include <asm/unaligned.h> |
36 | #include "ecryptfs_kernel.h" | 37 | #include "ecryptfs_kernel.h" |
37 | 38 | ||
@@ -70,15 +71,19 @@ ecryptfs_create_underlying_file(struct inode *lower_dir_inode, | |||
70 | struct vfsmount *lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry); | 71 | struct vfsmount *lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry); |
71 | struct dentry *dentry_save; | 72 | struct dentry *dentry_save; |
72 | struct vfsmount *vfsmount_save; | 73 | struct vfsmount *vfsmount_save; |
74 | unsigned int flags_save; | ||
73 | int rc; | 75 | int rc; |
74 | 76 | ||
75 | dentry_save = nd->path.dentry; | 77 | dentry_save = nd->path.dentry; |
76 | vfsmount_save = nd->path.mnt; | 78 | vfsmount_save = nd->path.mnt; |
79 | flags_save = nd->flags; | ||
77 | nd->path.dentry = lower_dentry; | 80 | nd->path.dentry = lower_dentry; |
78 | nd->path.mnt = lower_mnt; | 81 | nd->path.mnt = lower_mnt; |
82 | nd->flags &= ~LOOKUP_OPEN; | ||
79 | rc = vfs_create(lower_dir_inode, lower_dentry, mode, nd); | 83 | rc = vfs_create(lower_dir_inode, lower_dentry, mode, nd); |
80 | nd->path.dentry = dentry_save; | 84 | nd->path.dentry = dentry_save; |
81 | nd->path.mnt = vfsmount_save; | 85 | nd->path.mnt = vfsmount_save; |
86 | nd->flags = flags_save; | ||
82 | return rc; | 87 | return rc; |
83 | } | 88 | } |
84 | 89 | ||
@@ -1108,10 +1113,8 @@ ecryptfs_setxattr(struct dentry *dentry, const char *name, const void *value, | |||
1108 | rc = -EOPNOTSUPP; | 1113 | rc = -EOPNOTSUPP; |
1109 | goto out; | 1114 | goto out; |
1110 | } | 1115 | } |
1111 | mutex_lock(&lower_dentry->d_inode->i_mutex); | 1116 | |
1112 | rc = lower_dentry->d_inode->i_op->setxattr(lower_dentry, name, value, | 1117 | rc = vfs_setxattr(lower_dentry, name, value, size, flags); |
1113 | size, flags); | ||
1114 | mutex_unlock(&lower_dentry->d_inode->i_mutex); | ||
1115 | out: | 1118 | out: |
1116 | return rc; | 1119 | return rc; |
1117 | } | 1120 | } |
@@ -159,7 +159,26 @@ out: | |||
159 | 159 | ||
160 | #ifdef CONFIG_MMU | 160 | #ifdef CONFIG_MMU |
161 | 161 | ||
162 | static struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos, | 162 | void acct_arg_size(struct linux_binprm *bprm, unsigned long pages) |
163 | { | ||
164 | struct mm_struct *mm = current->mm; | ||
165 | long diff = (long)(pages - bprm->vma_pages); | ||
166 | |||
167 | if (!mm || !diff) | ||
168 | return; | ||
169 | |||
170 | bprm->vma_pages = pages; | ||
171 | |||
172 | #ifdef SPLIT_RSS_COUNTING | ||
173 | add_mm_counter(mm, MM_ANONPAGES, diff); | ||
174 | #else | ||
175 | spin_lock(&mm->page_table_lock); | ||
176 | add_mm_counter(mm, MM_ANONPAGES, diff); | ||
177 | spin_unlock(&mm->page_table_lock); | ||
178 | #endif | ||
179 | } | ||
180 | |||
181 | struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos, | ||
163 | int write) | 182 | int write) |
164 | { | 183 | { |
165 | struct page *page; | 184 | struct page *page; |
@@ -181,6 +200,8 @@ static struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos, | |||
181 | unsigned long size = bprm->vma->vm_end - bprm->vma->vm_start; | 200 | unsigned long size = bprm->vma->vm_end - bprm->vma->vm_start; |
182 | struct rlimit *rlim; | 201 | struct rlimit *rlim; |
183 | 202 | ||
203 | acct_arg_size(bprm, size / PAGE_SIZE); | ||
204 | |||
184 | /* | 205 | /* |
185 | * We've historically supported up to 32 pages (ARG_MAX) | 206 | * We've historically supported up to 32 pages (ARG_MAX) |
186 | * of argument strings even with small stacks | 207 | * of argument strings even with small stacks |
@@ -249,6 +270,11 @@ static int __bprm_mm_init(struct linux_binprm *bprm) | |||
249 | vma->vm_flags = VM_STACK_FLAGS | VM_STACK_INCOMPLETE_SETUP; | 270 | vma->vm_flags = VM_STACK_FLAGS | VM_STACK_INCOMPLETE_SETUP; |
250 | vma->vm_page_prot = vm_get_page_prot(vma->vm_flags); | 271 | vma->vm_page_prot = vm_get_page_prot(vma->vm_flags); |
251 | INIT_LIST_HEAD(&vma->anon_vma_chain); | 272 | INIT_LIST_HEAD(&vma->anon_vma_chain); |
273 | |||
274 | err = security_file_mmap(NULL, 0, 0, 0, vma->vm_start, 1); | ||
275 | if (err) | ||
276 | goto err; | ||
277 | |||
252 | err = insert_vm_struct(mm, vma); | 278 | err = insert_vm_struct(mm, vma); |
253 | if (err) | 279 | if (err) |
254 | goto err; | 280 | goto err; |
@@ -271,7 +297,11 @@ static bool valid_arg_len(struct linux_binprm *bprm, long len) | |||
271 | 297 | ||
272 | #else | 298 | #else |
273 | 299 | ||
274 | static struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos, | 300 | void acct_arg_size(struct linux_binprm *bprm, unsigned long pages) |
301 | { | ||
302 | } | ||
303 | |||
304 | struct page *get_arg_page(struct linux_binprm *bprm, unsigned long pos, | ||
275 | int write) | 305 | int write) |
276 | { | 306 | { |
277 | struct page *page; | 307 | struct page *page; |
@@ -994,6 +1024,7 @@ int flush_old_exec(struct linux_binprm * bprm) | |||
994 | /* | 1024 | /* |
995 | * Release all of the old mmap stuff | 1025 | * Release all of the old mmap stuff |
996 | */ | 1026 | */ |
1027 | acct_arg_size(bprm, 0); | ||
997 | retval = exec_mmap(bprm->mm); | 1028 | retval = exec_mmap(bprm->mm); |
998 | if (retval) | 1029 | if (retval) |
999 | goto out; | 1030 | goto out; |
@@ -1419,8 +1450,10 @@ int do_execve(const char * filename, | |||
1419 | return retval; | 1450 | return retval; |
1420 | 1451 | ||
1421 | out: | 1452 | out: |
1422 | if (bprm->mm) | 1453 | if (bprm->mm) { |
1423 | mmput (bprm->mm); | 1454 | acct_arg_size(bprm, 0); |
1455 | mmput(bprm->mm); | ||
1456 | } | ||
1424 | 1457 | ||
1425 | out_file: | 1458 | out_file: |
1426 | if (bprm->file) { | 1459 | if (bprm->file) { |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 4b8debeb3965..8705e36f32d6 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -4530,6 +4530,7 @@ static void ext4_free_branches(handle_t *handle, struct inode *inode, | |||
4530 | (__le32 *) bh->b_data, | 4530 | (__le32 *) bh->b_data, |
4531 | (__le32 *) bh->b_data + addr_per_block, | 4531 | (__le32 *) bh->b_data + addr_per_block, |
4532 | depth); | 4532 | depth); |
4533 | brelse(bh); | ||
4533 | 4534 | ||
4534 | /* | 4535 | /* |
4535 | * Everything below this this pointer has been | 4536 | * Everything below this this pointer has been |
diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 26147746c272..751997d2cefe 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c | |||
@@ -719,6 +719,7 @@ static void ext4_put_super(struct super_block *sb) | |||
719 | ext4_abort(sb, "Couldn't clean up the journal"); | 719 | ext4_abort(sb, "Couldn't clean up the journal"); |
720 | } | 720 | } |
721 | 721 | ||
722 | del_timer(&sbi->s_err_report); | ||
722 | ext4_release_system_zone(sb); | 723 | ext4_release_system_zone(sb); |
723 | ext4_mb_release(sb); | 724 | ext4_mb_release(sb); |
724 | ext4_ext_release(sb); | 725 | ext4_ext_release(sb); |
diff --git a/fs/fuse/file.c b/fs/fuse/file.c index c8224587123f..6c2717d421e8 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/kernel.h> | 13 | #include <linux/kernel.h> |
14 | #include <linux/sched.h> | 14 | #include <linux/sched.h> |
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/compat.h> | ||
16 | 17 | ||
17 | static const struct file_operations fuse_direct_io_file_operations; | 18 | static const struct file_operations fuse_direct_io_file_operations; |
18 | 19 | ||
@@ -134,6 +135,7 @@ EXPORT_SYMBOL_GPL(fuse_do_open); | |||
134 | void fuse_finish_open(struct inode *inode, struct file *file) | 135 | void fuse_finish_open(struct inode *inode, struct file *file) |
135 | { | 136 | { |
136 | struct fuse_file *ff = file->private_data; | 137 | struct fuse_file *ff = file->private_data; |
138 | struct fuse_conn *fc = get_fuse_conn(inode); | ||
137 | 139 | ||
138 | if (ff->open_flags & FOPEN_DIRECT_IO) | 140 | if (ff->open_flags & FOPEN_DIRECT_IO) |
139 | file->f_op = &fuse_direct_io_file_operations; | 141 | file->f_op = &fuse_direct_io_file_operations; |
@@ -141,6 +143,15 @@ void fuse_finish_open(struct inode *inode, struct file *file) | |||
141 | invalidate_inode_pages2(inode->i_mapping); | 143 | invalidate_inode_pages2(inode->i_mapping); |
142 | if (ff->open_flags & FOPEN_NONSEEKABLE) | 144 | if (ff->open_flags & FOPEN_NONSEEKABLE) |
143 | nonseekable_open(inode, file); | 145 | nonseekable_open(inode, file); |
146 | if (fc->atomic_o_trunc && (file->f_flags & O_TRUNC)) { | ||
147 | struct fuse_inode *fi = get_fuse_inode(inode); | ||
148 | |||
149 | spin_lock(&fc->lock); | ||
150 | fi->attr_version = ++fc->attr_version; | ||
151 | i_size_write(inode, 0); | ||
152 | spin_unlock(&fc->lock); | ||
153 | fuse_invalidate_attr(inode); | ||
154 | } | ||
144 | } | 155 | } |
145 | 156 | ||
146 | int fuse_open_common(struct inode *inode, struct file *file, bool isdir) | 157 | int fuse_open_common(struct inode *inode, struct file *file, bool isdir) |
@@ -1617,6 +1628,58 @@ static int fuse_ioctl_copy_user(struct page **pages, struct iovec *iov, | |||
1617 | return 0; | 1628 | return 0; |
1618 | } | 1629 | } |
1619 | 1630 | ||
1631 | /* Make sure iov_length() won't overflow */ | ||
1632 | static int fuse_verify_ioctl_iov(struct iovec *iov, size_t count) | ||
1633 | { | ||
1634 | size_t n; | ||
1635 | u32 max = FUSE_MAX_PAGES_PER_REQ << PAGE_SHIFT; | ||
1636 | |||
1637 | for (n = 0; n < count; n++) { | ||
1638 | if (iov->iov_len > (size_t) max) | ||
1639 | return -ENOMEM; | ||
1640 | max -= iov->iov_len; | ||
1641 | } | ||
1642 | return 0; | ||
1643 | } | ||
1644 | |||
1645 | /* | ||
1646 | * CUSE servers compiled on 32bit broke on 64bit kernels because the | ||
1647 | * ABI was defined to be 'struct iovec' which is different on 32bit | ||
1648 | * and 64bit. Fortunately we can determine which structure the server | ||
1649 | * used from the size of the reply. | ||
1650 | */ | ||
1651 | static int fuse_copy_ioctl_iovec(struct iovec *dst, void *src, | ||
1652 | size_t transferred, unsigned count, | ||
1653 | bool is_compat) | ||
1654 | { | ||
1655 | #ifdef CONFIG_COMPAT | ||
1656 | if (count * sizeof(struct compat_iovec) == transferred) { | ||
1657 | struct compat_iovec *ciov = src; | ||
1658 | unsigned i; | ||
1659 | |||
1660 | /* | ||
1661 | * With this interface a 32bit server cannot support | ||
1662 | * non-compat (i.e. ones coming from 64bit apps) ioctl | ||
1663 | * requests | ||
1664 | */ | ||
1665 | if (!is_compat) | ||
1666 | return -EINVAL; | ||
1667 | |||
1668 | for (i = 0; i < count; i++) { | ||
1669 | dst[i].iov_base = compat_ptr(ciov[i].iov_base); | ||
1670 | dst[i].iov_len = ciov[i].iov_len; | ||
1671 | } | ||
1672 | return 0; | ||
1673 | } | ||
1674 | #endif | ||
1675 | |||
1676 | if (count * sizeof(struct iovec) != transferred) | ||
1677 | return -EIO; | ||
1678 | |||
1679 | memcpy(dst, src, transferred); | ||
1680 | return 0; | ||
1681 | } | ||
1682 | |||
1620 | /* | 1683 | /* |
1621 | * For ioctls, there is no generic way to determine how much memory | 1684 | * For ioctls, there is no generic way to determine how much memory |
1622 | * needs to be read and/or written. Furthermore, ioctls are allowed | 1685 | * needs to be read and/or written. Furthermore, ioctls are allowed |
@@ -1798,18 +1861,25 @@ long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg, | |||
1798 | in_iovs + out_iovs > FUSE_IOCTL_MAX_IOV) | 1861 | in_iovs + out_iovs > FUSE_IOCTL_MAX_IOV) |
1799 | goto out; | 1862 | goto out; |
1800 | 1863 | ||
1801 | err = -EIO; | ||
1802 | if ((in_iovs + out_iovs) * sizeof(struct iovec) != transferred) | ||
1803 | goto out; | ||
1804 | |||
1805 | /* okay, copy in iovs and retry */ | ||
1806 | vaddr = kmap_atomic(pages[0], KM_USER0); | 1864 | vaddr = kmap_atomic(pages[0], KM_USER0); |
1807 | memcpy(page_address(iov_page), vaddr, transferred); | 1865 | err = fuse_copy_ioctl_iovec(page_address(iov_page), vaddr, |
1866 | transferred, in_iovs + out_iovs, | ||
1867 | (flags & FUSE_IOCTL_COMPAT) != 0); | ||
1808 | kunmap_atomic(vaddr, KM_USER0); | 1868 | kunmap_atomic(vaddr, KM_USER0); |
1869 | if (err) | ||
1870 | goto out; | ||
1809 | 1871 | ||
1810 | in_iov = page_address(iov_page); | 1872 | in_iov = page_address(iov_page); |
1811 | out_iov = in_iov + in_iovs; | 1873 | out_iov = in_iov + in_iovs; |
1812 | 1874 | ||
1875 | err = fuse_verify_ioctl_iov(in_iov, in_iovs); | ||
1876 | if (err) | ||
1877 | goto out; | ||
1878 | |||
1879 | err = fuse_verify_ioctl_iov(out_iov, out_iovs); | ||
1880 | if (err) | ||
1881 | goto out; | ||
1882 | |||
1813 | goto retry; | 1883 | goto retry; |
1814 | } | 1884 | } |
1815 | 1885 | ||
diff --git a/fs/hostfs/hostfs.h b/fs/hostfs/hostfs.h index 6bbd75c5589b..3ccb4e45b8dc 100644 --- a/fs/hostfs/hostfs.h +++ b/fs/hostfs/hostfs.h | |||
@@ -96,7 +96,6 @@ extern int rename_file(char *from, char *to); | |||
96 | extern int do_statfs(char *root, long *bsize_out, long long *blocks_out, | 96 | extern int do_statfs(char *root, long *bsize_out, long long *blocks_out, |
97 | long long *bfree_out, long long *bavail_out, | 97 | long long *bfree_out, long long *bavail_out, |
98 | long long *files_out, long long *ffree_out, | 98 | long long *files_out, long long *ffree_out, |
99 | void *fsid_out, int fsid_size, long *namelen_out, | 99 | void *fsid_out, int fsid_size, long *namelen_out); |
100 | long *spare_out); | ||
101 | 100 | ||
102 | #endif | 101 | #endif |
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index f7dc9b5f9ef8..cd7c93917cc7 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c | |||
@@ -217,7 +217,7 @@ int hostfs_statfs(struct dentry *dentry, struct kstatfs *sf) | |||
217 | err = do_statfs(dentry->d_sb->s_fs_info, | 217 | err = do_statfs(dentry->d_sb->s_fs_info, |
218 | &sf->f_bsize, &f_blocks, &f_bfree, &f_bavail, &f_files, | 218 | &sf->f_bsize, &f_blocks, &f_bfree, &f_bavail, &f_files, |
219 | &f_ffree, &sf->f_fsid, sizeof(sf->f_fsid), | 219 | &f_ffree, &sf->f_fsid, sizeof(sf->f_fsid), |
220 | &sf->f_namelen, sf->f_spare); | 220 | &sf->f_namelen); |
221 | if (err) | 221 | if (err) |
222 | return err; | 222 | return err; |
223 | sf->f_blocks = f_blocks; | 223 | sf->f_blocks = f_blocks; |
diff --git a/fs/hostfs/hostfs_user.c b/fs/hostfs/hostfs_user.c index 6777aa06ce2c..8d02683585e0 100644 --- a/fs/hostfs/hostfs_user.c +++ b/fs/hostfs/hostfs_user.c | |||
@@ -364,8 +364,7 @@ int rename_file(char *from, char *to) | |||
364 | int do_statfs(char *root, long *bsize_out, long long *blocks_out, | 364 | int do_statfs(char *root, long *bsize_out, long long *blocks_out, |
365 | long long *bfree_out, long long *bavail_out, | 365 | long long *bfree_out, long long *bavail_out, |
366 | long long *files_out, long long *ffree_out, | 366 | long long *files_out, long long *ffree_out, |
367 | void *fsid_out, int fsid_size, long *namelen_out, | 367 | void *fsid_out, int fsid_size, long *namelen_out) |
368 | long *spare_out) | ||
369 | { | 368 | { |
370 | struct statfs64 buf; | 369 | struct statfs64 buf; |
371 | int err; | 370 | int err; |
@@ -384,10 +383,6 @@ int do_statfs(char *root, long *bsize_out, long long *blocks_out, | |||
384 | sizeof(buf.f_fsid) > fsid_size ? fsid_size : | 383 | sizeof(buf.f_fsid) > fsid_size ? fsid_size : |
385 | sizeof(buf.f_fsid)); | 384 | sizeof(buf.f_fsid)); |
386 | *namelen_out = buf.f_namelen; | 385 | *namelen_out = buf.f_namelen; |
387 | spare_out[0] = buf.f_spare[0]; | 386 | |
388 | spare_out[1] = buf.f_spare[1]; | ||
389 | spare_out[2] = buf.f_spare[2]; | ||
390 | spare_out[3] = buf.f_spare[3]; | ||
391 | spare_out[4] = buf.f_spare[4]; | ||
392 | return 0; | 387 | return 0; |
393 | } | 388 | } |
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c index b9c3c43cea1d..98e8e35c4408 100644 --- a/fs/nfs/delegation.c +++ b/fs/nfs/delegation.c | |||
@@ -24,8 +24,6 @@ | |||
24 | 24 | ||
25 | static void nfs_do_free_delegation(struct nfs_delegation *delegation) | 25 | static void nfs_do_free_delegation(struct nfs_delegation *delegation) |
26 | { | 26 | { |
27 | if (delegation->cred) | ||
28 | put_rpccred(delegation->cred); | ||
29 | kfree(delegation); | 27 | kfree(delegation); |
30 | } | 28 | } |
31 | 29 | ||
@@ -38,6 +36,10 @@ static void nfs_free_delegation_callback(struct rcu_head *head) | |||
38 | 36 | ||
39 | static void nfs_free_delegation(struct nfs_delegation *delegation) | 37 | static void nfs_free_delegation(struct nfs_delegation *delegation) |
40 | { | 38 | { |
39 | if (delegation->cred) { | ||
40 | put_rpccred(delegation->cred); | ||
41 | delegation->cred = NULL; | ||
42 | } | ||
41 | call_rcu(&delegation->rcu, nfs_free_delegation_callback); | 43 | call_rcu(&delegation->rcu, nfs_free_delegation_callback); |
42 | } | 44 | } |
43 | 45 | ||
diff --git a/fs/nfs/direct.c b/fs/nfs/direct.c index 064a80961677..e0e9d49773bd 100644 --- a/fs/nfs/direct.c +++ b/fs/nfs/direct.c | |||
@@ -407,15 +407,18 @@ static ssize_t nfs_direct_read_schedule_iovec(struct nfs_direct_req *dreq, | |||
407 | pos += vec->iov_len; | 407 | pos += vec->iov_len; |
408 | } | 408 | } |
409 | 409 | ||
410 | /* | ||
411 | * If no bytes were started, return the error, and let the | ||
412 | * generic layer handle the completion. | ||
413 | */ | ||
414 | if (requested_bytes == 0) { | ||
415 | nfs_direct_req_release(dreq); | ||
416 | return result < 0 ? result : -EIO; | ||
417 | } | ||
418 | |||
410 | if (put_dreq(dreq)) | 419 | if (put_dreq(dreq)) |
411 | nfs_direct_complete(dreq); | 420 | nfs_direct_complete(dreq); |
412 | 421 | return 0; | |
413 | if (requested_bytes != 0) | ||
414 | return 0; | ||
415 | |||
416 | if (result < 0) | ||
417 | return result; | ||
418 | return -EIO; | ||
419 | } | 422 | } |
420 | 423 | ||
421 | static ssize_t nfs_direct_read(struct kiocb *iocb, const struct iovec *iov, | 424 | static ssize_t nfs_direct_read(struct kiocb *iocb, const struct iovec *iov, |
@@ -841,15 +844,18 @@ static ssize_t nfs_direct_write_schedule_iovec(struct nfs_direct_req *dreq, | |||
841 | pos += vec->iov_len; | 844 | pos += vec->iov_len; |
842 | } | 845 | } |
843 | 846 | ||
847 | /* | ||
848 | * If no bytes were started, return the error, and let the | ||
849 | * generic layer handle the completion. | ||
850 | */ | ||
851 | if (requested_bytes == 0) { | ||
852 | nfs_direct_req_release(dreq); | ||
853 | return result < 0 ? result : -EIO; | ||
854 | } | ||
855 | |||
844 | if (put_dreq(dreq)) | 856 | if (put_dreq(dreq)) |
845 | nfs_direct_write_complete(dreq, dreq->inode); | 857 | nfs_direct_write_complete(dreq, dreq->inode); |
846 | 858 | return 0; | |
847 | if (requested_bytes != 0) | ||
848 | return 0; | ||
849 | |||
850 | if (result < 0) | ||
851 | return result; | ||
852 | return -EIO; | ||
853 | } | 859 | } |
854 | 860 | ||
855 | static ssize_t nfs_direct_write(struct kiocb *iocb, const struct iovec *iov, | 861 | static ssize_t nfs_direct_write(struct kiocb *iocb, const struct iovec *iov, |
@@ -873,7 +879,7 @@ static ssize_t nfs_direct_write(struct kiocb *iocb, const struct iovec *iov, | |||
873 | dreq->inode = inode; | 879 | dreq->inode = inode; |
874 | dreq->ctx = get_nfs_open_context(nfs_file_open_context(iocb->ki_filp)); | 880 | dreq->ctx = get_nfs_open_context(nfs_file_open_context(iocb->ki_filp)); |
875 | dreq->l_ctx = nfs_get_lock_context(dreq->ctx); | 881 | dreq->l_ctx = nfs_get_lock_context(dreq->ctx); |
876 | if (dreq->l_ctx != NULL) | 882 | if (dreq->l_ctx == NULL) |
877 | goto out_release; | 883 | goto out_release; |
878 | if (!is_sync_kiocb(iocb)) | 884 | if (!is_sync_kiocb(iocb)) |
879 | dreq->iocb = iocb; | 885 | dreq->iocb = iocb; |
diff --git a/fs/nfs/file.c b/fs/nfs/file.c index 05bf3c0dc751..22a185b328ef 100644 --- a/fs/nfs/file.c +++ b/fs/nfs/file.c | |||
@@ -551,7 +551,7 @@ static int nfs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
551 | struct file *filp = vma->vm_file; | 551 | struct file *filp = vma->vm_file; |
552 | struct dentry *dentry = filp->f_path.dentry; | 552 | struct dentry *dentry = filp->f_path.dentry; |
553 | unsigned pagelen; | 553 | unsigned pagelen; |
554 | int ret = -EINVAL; | 554 | int ret = VM_FAULT_NOPAGE; |
555 | struct address_space *mapping; | 555 | struct address_space *mapping; |
556 | 556 | ||
557 | dfprintk(PAGECACHE, "NFS: vm_page_mkwrite(%s/%s(%ld), offset %lld)\n", | 557 | dfprintk(PAGECACHE, "NFS: vm_page_mkwrite(%s/%s(%ld), offset %lld)\n", |
@@ -567,21 +567,20 @@ static int nfs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf) | |||
567 | if (mapping != dentry->d_inode->i_mapping) | 567 | if (mapping != dentry->d_inode->i_mapping) |
568 | goto out_unlock; | 568 | goto out_unlock; |
569 | 569 | ||
570 | ret = 0; | ||
571 | pagelen = nfs_page_length(page); | 570 | pagelen = nfs_page_length(page); |
572 | if (pagelen == 0) | 571 | if (pagelen == 0) |
573 | goto out_unlock; | 572 | goto out_unlock; |
574 | 573 | ||
575 | ret = nfs_flush_incompatible(filp, page); | 574 | ret = VM_FAULT_LOCKED; |
576 | if (ret != 0) | 575 | if (nfs_flush_incompatible(filp, page) == 0 && |
577 | goto out_unlock; | 576 | nfs_updatepage(filp, page, 0, pagelen) == 0) |
577 | goto out; | ||
578 | 578 | ||
579 | ret = nfs_updatepage(filp, page, 0, pagelen); | 579 | ret = VM_FAULT_SIGBUS; |
580 | out_unlock: | 580 | out_unlock: |
581 | if (!ret) | ||
582 | return VM_FAULT_LOCKED; | ||
583 | unlock_page(page); | 581 | unlock_page(page); |
584 | return VM_FAULT_SIGBUS; | 582 | out: |
583 | return ret; | ||
585 | } | 584 | } |
586 | 585 | ||
587 | static const struct vm_operations_struct nfs_file_vm_ops = { | 586 | static const struct vm_operations_struct nfs_file_vm_ops = { |
@@ -688,6 +687,7 @@ static int do_getlk(struct file *filp, int cmd, struct file_lock *fl) | |||
688 | { | 687 | { |
689 | struct inode *inode = filp->f_mapping->host; | 688 | struct inode *inode = filp->f_mapping->host; |
690 | int status = 0; | 689 | int status = 0; |
690 | unsigned int saved_type = fl->fl_type; | ||
691 | 691 | ||
692 | /* Try local locking first */ | 692 | /* Try local locking first */ |
693 | posix_test_lock(filp, fl); | 693 | posix_test_lock(filp, fl); |
@@ -695,6 +695,7 @@ static int do_getlk(struct file *filp, int cmd, struct file_lock *fl) | |||
695 | /* found a conflict */ | 695 | /* found a conflict */ |
696 | goto out; | 696 | goto out; |
697 | } | 697 | } |
698 | fl->fl_type = saved_type; | ||
698 | 699 | ||
699 | if (nfs_have_delegation(inode, FMODE_READ)) | 700 | if (nfs_have_delegation(inode, FMODE_READ)) |
700 | goto out_noconflict; | 701 | goto out_noconflict; |
diff --git a/fs/nfs/mount_clnt.c b/fs/nfs/mount_clnt.c index 59047f8d7d72..3dde50c093b5 100644 --- a/fs/nfs/mount_clnt.c +++ b/fs/nfs/mount_clnt.c | |||
@@ -503,13 +503,13 @@ static struct rpc_procinfo mnt3_procedures[] = { | |||
503 | 503 | ||
504 | static struct rpc_version mnt_version1 = { | 504 | static struct rpc_version mnt_version1 = { |
505 | .number = 1, | 505 | .number = 1, |
506 | .nrprocs = 2, | 506 | .nrprocs = ARRAY_SIZE(mnt_procedures), |
507 | .procs = mnt_procedures, | 507 | .procs = mnt_procedures, |
508 | }; | 508 | }; |
509 | 509 | ||
510 | static struct rpc_version mnt_version3 = { | 510 | static struct rpc_version mnt_version3 = { |
511 | .number = 3, | 511 | .number = 3, |
512 | .nrprocs = 2, | 512 | .nrprocs = ARRAY_SIZE(mnt3_procedures), |
513 | .procs = mnt3_procedures, | 513 | .procs = mnt3_procedures, |
514 | }; | 514 | }; |
515 | 515 | ||
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index 089da5b5d20a..74aa54e1712e 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -255,9 +255,6 @@ static int nfs4_handle_exception(const struct nfs_server *server, int errorcode, | |||
255 | nfs4_state_mark_reclaim_nograce(clp, state); | 255 | nfs4_state_mark_reclaim_nograce(clp, state); |
256 | goto do_state_recovery; | 256 | goto do_state_recovery; |
257 | case -NFS4ERR_STALE_STATEID: | 257 | case -NFS4ERR_STALE_STATEID: |
258 | if (state == NULL) | ||
259 | break; | ||
260 | nfs4_state_mark_reclaim_reboot(clp, state); | ||
261 | case -NFS4ERR_STALE_CLIENTID: | 258 | case -NFS4ERR_STALE_CLIENTID: |
262 | case -NFS4ERR_EXPIRED: | 259 | case -NFS4ERR_EXPIRED: |
263 | goto do_state_recovery; | 260 | goto do_state_recovery; |
@@ -1120,6 +1117,7 @@ static int nfs4_open_recover(struct nfs4_opendata *opendata, struct nfs4_state * | |||
1120 | clear_bit(NFS_DELEGATED_STATE, &state->flags); | 1117 | clear_bit(NFS_DELEGATED_STATE, &state->flags); |
1121 | smp_rmb(); | 1118 | smp_rmb(); |
1122 | if (state->n_rdwr != 0) { | 1119 | if (state->n_rdwr != 0) { |
1120 | clear_bit(NFS_O_RDWR_STATE, &state->flags); | ||
1123 | ret = nfs4_open_recover_helper(opendata, FMODE_READ|FMODE_WRITE, &newstate); | 1121 | ret = nfs4_open_recover_helper(opendata, FMODE_READ|FMODE_WRITE, &newstate); |
1124 | if (ret != 0) | 1122 | if (ret != 0) |
1125 | return ret; | 1123 | return ret; |
@@ -1127,6 +1125,7 @@ static int nfs4_open_recover(struct nfs4_opendata *opendata, struct nfs4_state * | |||
1127 | return -ESTALE; | 1125 | return -ESTALE; |
1128 | } | 1126 | } |
1129 | if (state->n_wronly != 0) { | 1127 | if (state->n_wronly != 0) { |
1128 | clear_bit(NFS_O_WRONLY_STATE, &state->flags); | ||
1130 | ret = nfs4_open_recover_helper(opendata, FMODE_WRITE, &newstate); | 1129 | ret = nfs4_open_recover_helper(opendata, FMODE_WRITE, &newstate); |
1131 | if (ret != 0) | 1130 | if (ret != 0) |
1132 | return ret; | 1131 | return ret; |
@@ -1134,6 +1133,7 @@ static int nfs4_open_recover(struct nfs4_opendata *opendata, struct nfs4_state * | |||
1134 | return -ESTALE; | 1133 | return -ESTALE; |
1135 | } | 1134 | } |
1136 | if (state->n_rdonly != 0) { | 1135 | if (state->n_rdonly != 0) { |
1136 | clear_bit(NFS_O_RDONLY_STATE, &state->flags); | ||
1137 | ret = nfs4_open_recover_helper(opendata, FMODE_READ, &newstate); | 1137 | ret = nfs4_open_recover_helper(opendata, FMODE_READ, &newstate); |
1138 | if (ret != 0) | 1138 | if (ret != 0) |
1139 | return ret; | 1139 | return ret; |
@@ -3490,9 +3490,6 @@ nfs4_async_handle_error(struct rpc_task *task, const struct nfs_server *server, | |||
3490 | nfs4_state_mark_reclaim_nograce(clp, state); | 3490 | nfs4_state_mark_reclaim_nograce(clp, state); |
3491 | goto do_state_recovery; | 3491 | goto do_state_recovery; |
3492 | case -NFS4ERR_STALE_STATEID: | 3492 | case -NFS4ERR_STALE_STATEID: |
3493 | if (state == NULL) | ||
3494 | break; | ||
3495 | nfs4_state_mark_reclaim_reboot(clp, state); | ||
3496 | case -NFS4ERR_STALE_CLIENTID: | 3493 | case -NFS4ERR_STALE_CLIENTID: |
3497 | case -NFS4ERR_EXPIRED: | 3494 | case -NFS4ERR_EXPIRED: |
3498 | goto do_state_recovery; | 3495 | goto do_state_recovery; |
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index 3e2f19b04c06..940cf7c070af 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c | |||
@@ -1138,16 +1138,14 @@ static void nfs4_reclaim_complete(struct nfs_client *clp, | |||
1138 | (void)ops->reclaim_complete(clp); | 1138 | (void)ops->reclaim_complete(clp); |
1139 | } | 1139 | } |
1140 | 1140 | ||
1141 | static void nfs4_state_end_reclaim_reboot(struct nfs_client *clp) | 1141 | static int nfs4_state_clear_reclaim_reboot(struct nfs_client *clp) |
1142 | { | 1142 | { |
1143 | struct nfs4_state_owner *sp; | 1143 | struct nfs4_state_owner *sp; |
1144 | struct rb_node *pos; | 1144 | struct rb_node *pos; |
1145 | struct nfs4_state *state; | 1145 | struct nfs4_state *state; |
1146 | 1146 | ||
1147 | if (!test_and_clear_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state)) | 1147 | if (!test_and_clear_bit(NFS4CLNT_RECLAIM_REBOOT, &clp->cl_state)) |
1148 | return; | 1148 | return 0; |
1149 | |||
1150 | nfs4_reclaim_complete(clp, clp->cl_mvops->reboot_recovery_ops); | ||
1151 | 1149 | ||
1152 | for (pos = rb_first(&clp->cl_state_owners); pos != NULL; pos = rb_next(pos)) { | 1150 | for (pos = rb_first(&clp->cl_state_owners); pos != NULL; pos = rb_next(pos)) { |
1153 | sp = rb_entry(pos, struct nfs4_state_owner, so_client_node); | 1151 | sp = rb_entry(pos, struct nfs4_state_owner, so_client_node); |
@@ -1161,6 +1159,14 @@ static void nfs4_state_end_reclaim_reboot(struct nfs_client *clp) | |||
1161 | } | 1159 | } |
1162 | 1160 | ||
1163 | nfs_delegation_reap_unclaimed(clp); | 1161 | nfs_delegation_reap_unclaimed(clp); |
1162 | return 1; | ||
1163 | } | ||
1164 | |||
1165 | static void nfs4_state_end_reclaim_reboot(struct nfs_client *clp) | ||
1166 | { | ||
1167 | if (!nfs4_state_clear_reclaim_reboot(clp)) | ||
1168 | return; | ||
1169 | nfs4_reclaim_complete(clp, clp->cl_mvops->reboot_recovery_ops); | ||
1164 | } | 1170 | } |
1165 | 1171 | ||
1166 | static void nfs_delegation_clear_all(struct nfs_client *clp) | 1172 | static void nfs_delegation_clear_all(struct nfs_client *clp) |
@@ -1187,7 +1193,7 @@ static int nfs4_recovery_handle_error(struct nfs_client *clp, int error) | |||
1187 | case -NFS4ERR_STALE_CLIENTID: | 1193 | case -NFS4ERR_STALE_CLIENTID: |
1188 | case -NFS4ERR_LEASE_MOVED: | 1194 | case -NFS4ERR_LEASE_MOVED: |
1189 | set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state); | 1195 | set_bit(NFS4CLNT_LEASE_EXPIRED, &clp->cl_state); |
1190 | nfs4_state_end_reclaim_reboot(clp); | 1196 | nfs4_state_clear_reclaim_reboot(clp); |
1191 | nfs4_state_start_reclaim_reboot(clp); | 1197 | nfs4_state_start_reclaim_reboot(clp); |
1192 | break; | 1198 | break; |
1193 | case -NFS4ERR_EXPIRED: | 1199 | case -NFS4ERR_EXPIRED: |
diff --git a/fs/nfs/pagelist.c b/fs/nfs/pagelist.c index 919490232e17..137b549e63db 100644 --- a/fs/nfs/pagelist.c +++ b/fs/nfs/pagelist.c | |||
@@ -65,6 +65,13 @@ nfs_create_request(struct nfs_open_context *ctx, struct inode *inode, | |||
65 | if (req == NULL) | 65 | if (req == NULL) |
66 | return ERR_PTR(-ENOMEM); | 66 | return ERR_PTR(-ENOMEM); |
67 | 67 | ||
68 | /* get lock context early so we can deal with alloc failures */ | ||
69 | req->wb_lock_context = nfs_get_lock_context(ctx); | ||
70 | if (req->wb_lock_context == NULL) { | ||
71 | nfs_page_free(req); | ||
72 | return ERR_PTR(-ENOMEM); | ||
73 | } | ||
74 | |||
68 | /* Initialize the request struct. Initially, we assume a | 75 | /* Initialize the request struct. Initially, we assume a |
69 | * long write-back delay. This will be adjusted in | 76 | * long write-back delay. This will be adjusted in |
70 | * update_nfs_request below if the region is not locked. */ | 77 | * update_nfs_request below if the region is not locked. */ |
@@ -79,7 +86,6 @@ nfs_create_request(struct nfs_open_context *ctx, struct inode *inode, | |||
79 | req->wb_pgbase = offset; | 86 | req->wb_pgbase = offset; |
80 | req->wb_bytes = count; | 87 | req->wb_bytes = count; |
81 | req->wb_context = get_nfs_open_context(ctx); | 88 | req->wb_context = get_nfs_open_context(ctx); |
82 | req->wb_lock_context = nfs_get_lock_context(ctx); | ||
83 | kref_init(&req->wb_kref); | 89 | kref_init(&req->wb_kref); |
84 | return req; | 90 | return req; |
85 | } | 91 | } |
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c index 2a533a0af2a9..7e84a852cdae 100644 --- a/fs/nfsd/nfs3xdr.c +++ b/fs/nfsd/nfs3xdr.c | |||
@@ -260,9 +260,11 @@ void fill_post_wcc(struct svc_fh *fhp) | |||
260 | err = vfs_getattr(fhp->fh_export->ex_path.mnt, fhp->fh_dentry, | 260 | err = vfs_getattr(fhp->fh_export->ex_path.mnt, fhp->fh_dentry, |
261 | &fhp->fh_post_attr); | 261 | &fhp->fh_post_attr); |
262 | fhp->fh_post_change = fhp->fh_dentry->d_inode->i_version; | 262 | fhp->fh_post_change = fhp->fh_dentry->d_inode->i_version; |
263 | if (err) | 263 | if (err) { |
264 | fhp->fh_post_saved = 0; | 264 | fhp->fh_post_saved = 0; |
265 | else | 265 | /* Grab the ctime anyway - set_change_info might use it */ |
266 | fhp->fh_post_attr.ctime = fhp->fh_dentry->d_inode->i_ctime; | ||
267 | } else | ||
266 | fhp->fh_post_saved = 1; | 268 | fhp->fh_post_saved = 1; |
267 | } | 269 | } |
268 | 270 | ||
diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h index 4d476ff08ae6..60fce3dc5cb5 100644 --- a/fs/nfsd/xdr4.h +++ b/fs/nfsd/xdr4.h | |||
@@ -484,18 +484,17 @@ static inline bool nfsd4_not_cached(struct nfsd4_compoundres *resp) | |||
484 | static inline void | 484 | static inline void |
485 | set_change_info(struct nfsd4_change_info *cinfo, struct svc_fh *fhp) | 485 | set_change_info(struct nfsd4_change_info *cinfo, struct svc_fh *fhp) |
486 | { | 486 | { |
487 | BUG_ON(!fhp->fh_pre_saved || !fhp->fh_post_saved); | 487 | BUG_ON(!fhp->fh_pre_saved); |
488 | cinfo->atomic = 1; | 488 | cinfo->atomic = fhp->fh_post_saved; |
489 | cinfo->change_supported = IS_I_VERSION(fhp->fh_dentry->d_inode); | 489 | cinfo->change_supported = IS_I_VERSION(fhp->fh_dentry->d_inode); |
490 | if (cinfo->change_supported) { | 490 | |
491 | cinfo->before_change = fhp->fh_pre_change; | 491 | cinfo->before_change = fhp->fh_pre_change; |
492 | cinfo->after_change = fhp->fh_post_change; | 492 | cinfo->after_change = fhp->fh_post_change; |
493 | } else { | 493 | cinfo->before_ctime_sec = fhp->fh_pre_ctime.tv_sec; |
494 | cinfo->before_ctime_sec = fhp->fh_pre_ctime.tv_sec; | 494 | cinfo->before_ctime_nsec = fhp->fh_pre_ctime.tv_nsec; |
495 | cinfo->before_ctime_nsec = fhp->fh_pre_ctime.tv_nsec; | 495 | cinfo->after_ctime_sec = fhp->fh_post_attr.ctime.tv_sec; |
496 | cinfo->after_ctime_sec = fhp->fh_post_attr.ctime.tv_sec; | 496 | cinfo->after_ctime_nsec = fhp->fh_post_attr.ctime.tv_nsec; |
497 | cinfo->after_ctime_nsec = fhp->fh_post_attr.ctime.tv_nsec; | 497 | |
498 | } | ||
499 | } | 498 | } |
500 | 499 | ||
501 | int nfs4svc_encode_voidres(struct svc_rqst *, __be32 *, void *); | 500 | int nfs4svc_encode_voidres(struct svc_rqst *, __be32 *, void *); |
diff --git a/fs/nilfs2/super.c b/fs/nilfs2/super.c index 922263393c76..57878bd94411 100644 --- a/fs/nilfs2/super.c +++ b/fs/nilfs2/super.c | |||
@@ -733,7 +733,8 @@ static int nilfs_setup_super(struct nilfs_sb_info *sbi) | |||
733 | cpu_to_le16(le16_to_cpu(sbp[0]->s_state) & ~NILFS_VALID_FS); | 733 | cpu_to_le16(le16_to_cpu(sbp[0]->s_state) & ~NILFS_VALID_FS); |
734 | sbp[0]->s_mtime = cpu_to_le64(get_seconds()); | 734 | sbp[0]->s_mtime = cpu_to_le64(get_seconds()); |
735 | /* synchronize sbp[1] with sbp[0] */ | 735 | /* synchronize sbp[1] with sbp[0] */ |
736 | memcpy(sbp[1], sbp[0], nilfs->ns_sbsize); | 736 | if (sbp[1]) |
737 | memcpy(sbp[1], sbp[0], nilfs->ns_sbsize); | ||
737 | return nilfs_commit_super(sbi, NILFS_SB_COMMIT_ALL); | 738 | return nilfs_commit_super(sbi, NILFS_SB_COMMIT_ALL); |
738 | } | 739 | } |
739 | 740 | ||
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c index bf7f6d776c31..5b7c6fe7fb61 100644 --- a/fs/notify/inotify/inotify_user.c +++ b/fs/notify/inotify/inotify_user.c | |||
@@ -751,6 +751,7 @@ SYSCALL_DEFINE1(inotify_init1, int, flags) | |||
751 | if (ret >= 0) | 751 | if (ret >= 0) |
752 | return ret; | 752 | return ret; |
753 | 753 | ||
754 | fsnotify_put_group(group); | ||
754 | atomic_dec(&user->inotify_devs); | 755 | atomic_dec(&user->inotify_devs); |
755 | out_free_uid: | 756 | out_free_uid: |
756 | free_uid(user); | 757 | free_uid(user); |
@@ -382,7 +382,7 @@ pipe_read(struct kiocb *iocb, const struct iovec *_iov, | |||
382 | error = ops->confirm(pipe, buf); | 382 | error = ops->confirm(pipe, buf); |
383 | if (error) { | 383 | if (error) { |
384 | if (!ret) | 384 | if (!ret) |
385 | error = ret; | 385 | ret = error; |
386 | break; | 386 | break; |
387 | } | 387 | } |
388 | 388 | ||
@@ -1197,12 +1197,24 @@ int pipe_proc_fn(struct ctl_table *table, int write, void __user *buf, | |||
1197 | return ret; | 1197 | return ret; |
1198 | } | 1198 | } |
1199 | 1199 | ||
1200 | /* | ||
1201 | * After the inode slimming patch, i_pipe/i_bdev/i_cdev share the same | ||
1202 | * location, so checking ->i_pipe is not enough to verify that this is a | ||
1203 | * pipe. | ||
1204 | */ | ||
1205 | struct pipe_inode_info *get_pipe_info(struct file *file) | ||
1206 | { | ||
1207 | struct inode *i = file->f_path.dentry->d_inode; | ||
1208 | |||
1209 | return S_ISFIFO(i->i_mode) ? i->i_pipe : NULL; | ||
1210 | } | ||
1211 | |||
1200 | long pipe_fcntl(struct file *file, unsigned int cmd, unsigned long arg) | 1212 | long pipe_fcntl(struct file *file, unsigned int cmd, unsigned long arg) |
1201 | { | 1213 | { |
1202 | struct pipe_inode_info *pipe; | 1214 | struct pipe_inode_info *pipe; |
1203 | long ret; | 1215 | long ret; |
1204 | 1216 | ||
1205 | pipe = file->f_path.dentry->d_inode->i_pipe; | 1217 | pipe = get_pipe_info(file); |
1206 | if (!pipe) | 1218 | if (!pipe) |
1207 | return -EBADF; | 1219 | return -EBADF; |
1208 | 1220 | ||
diff --git a/fs/proc/base.c b/fs/proc/base.c index 8e4addaa5424..632b9071ad2e 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -1526,7 +1526,7 @@ static int do_proc_readlink(struct path *path, char __user *buffer, int buflen) | |||
1526 | if (!tmp) | 1526 | if (!tmp) |
1527 | return -ENOMEM; | 1527 | return -ENOMEM; |
1528 | 1528 | ||
1529 | pathname = d_path_with_unreachable(path, tmp, PAGE_SIZE); | 1529 | pathname = d_path(path, tmp, PAGE_SIZE); |
1530 | len = PTR_ERR(pathname); | 1530 | len = PTR_ERR(pathname); |
1531 | if (IS_ERR(pathname)) | 1531 | if (IS_ERR(pathname)) |
1532 | goto out; | 1532 | goto out; |
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c index 6f37c391468d..d245cb23dd72 100644 --- a/fs/proc/kcore.c +++ b/fs/proc/kcore.c | |||
@@ -558,7 +558,7 @@ static int open_kcore(struct inode *inode, struct file *filp) | |||
558 | static const struct file_operations proc_kcore_operations = { | 558 | static const struct file_operations proc_kcore_operations = { |
559 | .read = read_kcore, | 559 | .read = read_kcore, |
560 | .open = open_kcore, | 560 | .open = open_kcore, |
561 | .llseek = generic_file_llseek, | 561 | .llseek = default_llseek, |
562 | }; | 562 | }; |
563 | 563 | ||
564 | #ifdef CONFIG_MEMORY_HOTPLUG | 564 | #ifdef CONFIG_MEMORY_HOTPLUG |
diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c index 5cbb81e134ac..4131f4a49391 100644 --- a/fs/reiserfs/ioctl.c +++ b/fs/reiserfs/ioctl.c | |||
@@ -186,12 +186,11 @@ int reiserfs_unpack(struct inode *inode, struct file *filp) | |||
186 | return 0; | 186 | return 0; |
187 | } | 187 | } |
188 | 188 | ||
189 | /* we need to make sure nobody is changing the file size beneath | ||
190 | ** us | ||
191 | */ | ||
192 | reiserfs_mutex_lock_safe(&inode->i_mutex, inode->i_sb); | ||
193 | depth = reiserfs_write_lock_once(inode->i_sb); | 189 | depth = reiserfs_write_lock_once(inode->i_sb); |
194 | 190 | ||
191 | /* we need to make sure nobody is changing the file size beneath us */ | ||
192 | reiserfs_mutex_lock_safe(&inode->i_mutex, inode->i_sb); | ||
193 | |||
195 | write_from = inode->i_size & (blocksize - 1); | 194 | write_from = inode->i_size & (blocksize - 1); |
196 | /* if we are on a block boundary, we are already unpacked. */ | 195 | /* if we are on a block boundary, we are already unpacked. */ |
197 | if (write_from == 0) { | 196 | if (write_from == 0) { |
diff --git a/fs/reiserfs/xattr_acl.c b/fs/reiserfs/xattr_acl.c index 536d697a8a28..90d2fcb67a31 100644 --- a/fs/reiserfs/xattr_acl.c +++ b/fs/reiserfs/xattr_acl.c | |||
@@ -472,7 +472,9 @@ int reiserfs_acl_chmod(struct inode *inode) | |||
472 | struct reiserfs_transaction_handle th; | 472 | struct reiserfs_transaction_handle th; |
473 | size_t size = reiserfs_xattr_nblocks(inode, | 473 | size_t size = reiserfs_xattr_nblocks(inode, |
474 | reiserfs_acl_size(clone->a_count)); | 474 | reiserfs_acl_size(clone->a_count)); |
475 | reiserfs_write_lock(inode->i_sb); | 475 | int depth; |
476 | |||
477 | depth = reiserfs_write_lock_once(inode->i_sb); | ||
476 | error = journal_begin(&th, inode->i_sb, size * 2); | 478 | error = journal_begin(&th, inode->i_sb, size * 2); |
477 | if (!error) { | 479 | if (!error) { |
478 | int error2; | 480 | int error2; |
@@ -482,7 +484,7 @@ int reiserfs_acl_chmod(struct inode *inode) | |||
482 | if (error2) | 484 | if (error2) |
483 | error = error2; | 485 | error = error2; |
484 | } | 486 | } |
485 | reiserfs_write_unlock(inode->i_sb); | 487 | reiserfs_write_unlock_once(inode->i_sb, depth); |
486 | } | 488 | } |
487 | posix_acl_release(clone); | 489 | posix_acl_release(clone); |
488 | return error; | 490 | return error; |
diff --git a/fs/splice.c b/fs/splice.c index 8f1dfaecc8f0..ce2f02579e35 100644 --- a/fs/splice.c +++ b/fs/splice.c | |||
@@ -1311,18 +1311,6 @@ long do_splice_direct(struct file *in, loff_t *ppos, struct file *out, | |||
1311 | static int splice_pipe_to_pipe(struct pipe_inode_info *ipipe, | 1311 | static int splice_pipe_to_pipe(struct pipe_inode_info *ipipe, |
1312 | struct pipe_inode_info *opipe, | 1312 | struct pipe_inode_info *opipe, |
1313 | size_t len, unsigned int flags); | 1313 | size_t len, unsigned int flags); |
1314 | /* | ||
1315 | * After the inode slimming patch, i_pipe/i_bdev/i_cdev share the same | ||
1316 | * location, so checking ->i_pipe is not enough to verify that this is a | ||
1317 | * pipe. | ||
1318 | */ | ||
1319 | static inline struct pipe_inode_info *pipe_info(struct inode *inode) | ||
1320 | { | ||
1321 | if (S_ISFIFO(inode->i_mode)) | ||
1322 | return inode->i_pipe; | ||
1323 | |||
1324 | return NULL; | ||
1325 | } | ||
1326 | 1314 | ||
1327 | /* | 1315 | /* |
1328 | * Determine where to splice to/from. | 1316 | * Determine where to splice to/from. |
@@ -1336,8 +1324,8 @@ static long do_splice(struct file *in, loff_t __user *off_in, | |||
1336 | loff_t offset, *off; | 1324 | loff_t offset, *off; |
1337 | long ret; | 1325 | long ret; |
1338 | 1326 | ||
1339 | ipipe = pipe_info(in->f_path.dentry->d_inode); | 1327 | ipipe = get_pipe_info(in); |
1340 | opipe = pipe_info(out->f_path.dentry->d_inode); | 1328 | opipe = get_pipe_info(out); |
1341 | 1329 | ||
1342 | if (ipipe && opipe) { | 1330 | if (ipipe && opipe) { |
1343 | if (off_in || off_out) | 1331 | if (off_in || off_out) |
@@ -1555,7 +1543,7 @@ static long vmsplice_to_user(struct file *file, const struct iovec __user *iov, | |||
1555 | int error; | 1543 | int error; |
1556 | long ret; | 1544 | long ret; |
1557 | 1545 | ||
1558 | pipe = pipe_info(file->f_path.dentry->d_inode); | 1546 | pipe = get_pipe_info(file); |
1559 | if (!pipe) | 1547 | if (!pipe) |
1560 | return -EBADF; | 1548 | return -EBADF; |
1561 | 1549 | ||
@@ -1642,7 +1630,7 @@ static long vmsplice_to_pipe(struct file *file, const struct iovec __user *iov, | |||
1642 | }; | 1630 | }; |
1643 | long ret; | 1631 | long ret; |
1644 | 1632 | ||
1645 | pipe = pipe_info(file->f_path.dentry->d_inode); | 1633 | pipe = get_pipe_info(file); |
1646 | if (!pipe) | 1634 | if (!pipe) |
1647 | return -EBADF; | 1635 | return -EBADF; |
1648 | 1636 | ||
@@ -2022,8 +2010,8 @@ static int link_pipe(struct pipe_inode_info *ipipe, | |||
2022 | static long do_tee(struct file *in, struct file *out, size_t len, | 2010 | static long do_tee(struct file *in, struct file *out, size_t len, |
2023 | unsigned int flags) | 2011 | unsigned int flags) |
2024 | { | 2012 | { |
2025 | struct pipe_inode_info *ipipe = pipe_info(in->f_path.dentry->d_inode); | 2013 | struct pipe_inode_info *ipipe = get_pipe_info(in); |
2026 | struct pipe_inode_info *opipe = pipe_info(out->f_path.dentry->d_inode); | 2014 | struct pipe_inode_info *opipe = get_pipe_info(out); |
2027 | int ret = -EINVAL; | 2015 | int ret = -EINVAL; |
2028 | 2016 | ||
2029 | /* | 2017 | /* |