aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDavid Woodhouse <dwmw2@infradead.org>2007-08-01 06:23:57 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2007-08-01 06:23:57 -0400
commit440fdb53b4ae58602711b5b8c3a139ace2404dbb (patch)
treec6fb88d6ad537ec53aeecadc75a61ab6147d4c9c /fs
parent8b2b403ce0f1a816b7a6a4f47c8798003b26c07a (diff)
parent8d4fbcfbe0a4bfc73e7f0297c59ae514e1f1436f (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'fs')
-rw-r--r--fs/afs/flock.c126
-rw-r--r--fs/bio.c30
-rw-r--r--fs/compat_ioctl.c20
-rw-r--r--fs/dcookies.c1
-rw-r--r--fs/ext2/super.c2
-rw-r--r--fs/ext3/super.c2
-rw-r--r--fs/ext4/extents.c2
-rw-r--r--fs/ext4/super.c2
-rw-r--r--fs/gfs2/ops_file.c2
-rw-r--r--fs/isofs/inode.c9
-rw-r--r--fs/lockd/svclock.c6
-rw-r--r--fs/locks.c8
-rw-r--r--fs/ncpfs/ncplib_kernel.c3
-rw-r--r--fs/nfsd/export.c5
-rw-r--r--fs/nfsd/nfs4idmap.c6
-rw-r--r--fs/nfsd/nfs4proc.c10
-rw-r--r--fs/nfsd/nfs4xdr.c2
-rw-r--r--fs/nfsd/vfs.c5
-rw-r--r--fs/ocfs2/file.c2
-rw-r--r--fs/open.c18
-rw-r--r--fs/partitions/msdos.c5
-rw-r--r--fs/partitions/sun.c62
-rw-r--r--fs/partitions/sun.h1
-rw-r--r--fs/pipe.c2
-rw-r--r--fs/proc/base.c2
-rw-r--r--fs/proc/inode.c24
-rw-r--r--fs/quota.c2
-rw-r--r--fs/ramfs/file-nommu.c7
-rw-r--r--fs/reiserfs/stree.c5
-rw-r--r--fs/signalfd.c2
-rw-r--r--fs/splice.c4
-rw-r--r--fs/timerfd.c6
-rw-r--r--fs/udf/inode.c10
-rw-r--r--fs/udf/super.c2
-rw-r--r--fs/udf/udf_sb.h2
-rw-r--r--fs/xfs/linux-2.6/xfs_ioctl32.c4
36 files changed, 269 insertions, 132 deletions
diff --git a/fs/afs/flock.c b/fs/afs/flock.c
index 4f77f3caee97..af6952e39a18 100644
--- a/fs/afs/flock.c
+++ b/fs/afs/flock.c
@@ -19,6 +19,7 @@ static void afs_fl_copy_lock(struct file_lock *new, struct file_lock *fl);
19static void afs_fl_release_private(struct file_lock *fl); 19static void afs_fl_release_private(struct file_lock *fl);
20 20
21static struct workqueue_struct *afs_lock_manager; 21static struct workqueue_struct *afs_lock_manager;
22static DEFINE_MUTEX(afs_lock_manager_mutex);
22 23
23static struct file_lock_operations afs_lock_ops = { 24static struct file_lock_operations afs_lock_ops = {
24 .fl_copy_lock = afs_fl_copy_lock, 25 .fl_copy_lock = afs_fl_copy_lock,
@@ -30,12 +31,20 @@ static struct file_lock_operations afs_lock_ops = {
30 */ 31 */
31static int afs_init_lock_manager(void) 32static int afs_init_lock_manager(void)
32{ 33{
34 int ret;
35
36 ret = 0;
33 if (!afs_lock_manager) { 37 if (!afs_lock_manager) {
34 afs_lock_manager = create_singlethread_workqueue("kafs_lockd"); 38 mutex_lock(&afs_lock_manager_mutex);
35 if (!afs_lock_manager) 39 if (!afs_lock_manager) {
36 return -ENOMEM; 40 afs_lock_manager =
41 create_singlethread_workqueue("kafs_lockd");
42 if (!afs_lock_manager)
43 ret = -ENOMEM;
44 }
45 mutex_unlock(&afs_lock_manager_mutex);
37 } 46 }
38 return 0; 47 return ret;
39} 48}
40 49
41/* 50/*
@@ -68,6 +77,29 @@ static void afs_schedule_lock_extension(struct afs_vnode *vnode)
68} 77}
69 78
70/* 79/*
80 * grant one or more locks (readlocks are allowed to jump the queue if the
81 * first lock in the queue is itself a readlock)
82 * - the caller must hold the vnode lock
83 */
84static void afs_grant_locks(struct afs_vnode *vnode, struct file_lock *fl)
85{
86 struct file_lock *p, *_p;
87
88 list_move_tail(&fl->fl_u.afs.link, &vnode->granted_locks);
89 if (fl->fl_type == F_RDLCK) {
90 list_for_each_entry_safe(p, _p, &vnode->pending_locks,
91 fl_u.afs.link) {
92 if (p->fl_type == F_RDLCK) {
93 p->fl_u.afs.state = AFS_LOCK_GRANTED;
94 list_move_tail(&p->fl_u.afs.link,
95 &vnode->granted_locks);
96 wake_up(&p->fl_wait);
97 }
98 }
99 }
100}
101
102/*
71 * do work for a lock, including: 103 * do work for a lock, including:
72 * - probing for a lock we're waiting on but didn't get immediately 104 * - probing for a lock we're waiting on but didn't get immediately
73 * - extending a lock that's close to timing out 105 * - extending a lock that's close to timing out
@@ -172,8 +204,7 @@ void afs_lock_work(struct work_struct *work)
172 struct file_lock, fl_u.afs.link) == fl) { 204 struct file_lock, fl_u.afs.link) == fl) {
173 fl->fl_u.afs.state = ret; 205 fl->fl_u.afs.state = ret;
174 if (ret == AFS_LOCK_GRANTED) 206 if (ret == AFS_LOCK_GRANTED)
175 list_move_tail(&fl->fl_u.afs.link, 207 afs_grant_locks(vnode, fl);
176 &vnode->granted_locks);
177 else 208 else
178 list_del_init(&fl->fl_u.afs.link); 209 list_del_init(&fl->fl_u.afs.link);
179 wake_up(&fl->fl_wait); 210 wake_up(&fl->fl_wait);
@@ -258,49 +289,50 @@ static int afs_do_setlk(struct file *file, struct file_lock *fl)
258 289
259 spin_lock(&vnode->lock); 290 spin_lock(&vnode->lock);
260 291
261 if (list_empty(&vnode->pending_locks)) { 292 /* if we've already got a readlock on the server then we can instantly
262 /* if there's no-one else with a lock on this vnode, then we 293 * grant another readlock, irrespective of whether there are any
263 * need to ask the server for a lock */ 294 * pending writelocks */
264 if (list_empty(&vnode->granted_locks)) { 295 if (type == AFS_LOCK_READ &&
265 _debug("not locked"); 296 vnode->flags & (1 << AFS_VNODE_READLOCKED)) {
266 ASSERTCMP(vnode->flags & 297 _debug("instant readlock");
267 ((1 << AFS_VNODE_LOCKING) | 298 ASSERTCMP(vnode->flags &
268 (1 << AFS_VNODE_READLOCKED) | 299 ((1 << AFS_VNODE_LOCKING) |
269 (1 << AFS_VNODE_WRITELOCKED)), ==, 0); 300 (1 << AFS_VNODE_WRITELOCKED)), ==, 0);
270 list_add_tail(&fl->fl_u.afs.link, &vnode->pending_locks); 301 ASSERT(!list_empty(&vnode->granted_locks));
271 set_bit(AFS_VNODE_LOCKING, &vnode->flags); 302 goto sharing_existing_lock;
272 spin_unlock(&vnode->lock); 303 }
273 304
274 ret = afs_vnode_set_lock(vnode, key, type); 305 /* if there's no-one else with a lock on this vnode, then we need to
275 clear_bit(AFS_VNODE_LOCKING, &vnode->flags); 306 * ask the server for a lock */
276 switch (ret) { 307 if (list_empty(&vnode->pending_locks) &&
277 case 0: 308 list_empty(&vnode->granted_locks)) {
278 goto acquired_server_lock; 309 _debug("not locked");
279 case -EWOULDBLOCK: 310 ASSERTCMP(vnode->flags &
280 spin_lock(&vnode->lock); 311 ((1 << AFS_VNODE_LOCKING) |
281 ASSERT(list_empty(&vnode->granted_locks)); 312 (1 << AFS_VNODE_READLOCKED) |
282 ASSERTCMP(vnode->pending_locks.next, ==, 313 (1 << AFS_VNODE_WRITELOCKED)), ==, 0);
283 &fl->fl_u.afs.link); 314 list_add_tail(&fl->fl_u.afs.link, &vnode->pending_locks);
284 goto wait; 315 set_bit(AFS_VNODE_LOCKING, &vnode->flags);
285 default: 316 spin_unlock(&vnode->lock);
286 spin_lock(&vnode->lock);
287 list_del_init(&fl->fl_u.afs.link);
288 spin_unlock(&vnode->lock);
289 goto error;
290 }
291 }
292 317
293 /* if we've already got a readlock on the server and no waiting 318 ret = afs_vnode_set_lock(vnode, key, type);
294 * writelocks, then we might be able to instantly grant another 319 clear_bit(AFS_VNODE_LOCKING, &vnode->flags);
295 * readlock */ 320 switch (ret) {
296 if (type == AFS_LOCK_READ && 321 case 0:
297 vnode->flags & (1 << AFS_VNODE_READLOCKED)) { 322 _debug("acquired");
298 _debug("instant readlock"); 323 goto acquired_server_lock;
299 ASSERTCMP(vnode->flags & 324 case -EWOULDBLOCK:
300 ((1 << AFS_VNODE_LOCKING) | 325 _debug("would block");
301 (1 << AFS_VNODE_WRITELOCKED)), ==, 0); 326 spin_lock(&vnode->lock);
302 ASSERT(!list_empty(&vnode->granted_locks)); 327 ASSERT(list_empty(&vnode->granted_locks));
303 goto sharing_existing_lock; 328 ASSERTCMP(vnode->pending_locks.next, ==,
329 &fl->fl_u.afs.link);
330 goto wait;
331 default:
332 spin_lock(&vnode->lock);
333 list_del_init(&fl->fl_u.afs.link);
334 spin_unlock(&vnode->lock);
335 goto error;
304 } 336 }
305 } 337 }
306 338
diff --git a/fs/bio.c b/fs/bio.c
index 0d2c2d38b7ba..29a44c1b64c6 100644
--- a/fs/bio.c
+++ b/fs/bio.c
@@ -230,7 +230,7 @@ void bio_put(struct bio *bio)
230 } 230 }
231} 231}
232 232
233inline int bio_phys_segments(request_queue_t *q, struct bio *bio) 233inline int bio_phys_segments(struct request_queue *q, struct bio *bio)
234{ 234{
235 if (unlikely(!bio_flagged(bio, BIO_SEG_VALID))) 235 if (unlikely(!bio_flagged(bio, BIO_SEG_VALID)))
236 blk_recount_segments(q, bio); 236 blk_recount_segments(q, bio);
@@ -238,7 +238,7 @@ inline int bio_phys_segments(request_queue_t *q, struct bio *bio)
238 return bio->bi_phys_segments; 238 return bio->bi_phys_segments;
239} 239}
240 240
241inline int bio_hw_segments(request_queue_t *q, struct bio *bio) 241inline int bio_hw_segments(struct request_queue *q, struct bio *bio)
242{ 242{
243 if (unlikely(!bio_flagged(bio, BIO_SEG_VALID))) 243 if (unlikely(!bio_flagged(bio, BIO_SEG_VALID)))
244 blk_recount_segments(q, bio); 244 blk_recount_segments(q, bio);
@@ -257,7 +257,7 @@ inline int bio_hw_segments(request_queue_t *q, struct bio *bio)
257 */ 257 */
258void __bio_clone(struct bio *bio, struct bio *bio_src) 258void __bio_clone(struct bio *bio, struct bio *bio_src)
259{ 259{
260 request_queue_t *q = bdev_get_queue(bio_src->bi_bdev); 260 struct request_queue *q = bdev_get_queue(bio_src->bi_bdev);
261 261
262 memcpy(bio->bi_io_vec, bio_src->bi_io_vec, 262 memcpy(bio->bi_io_vec, bio_src->bi_io_vec,
263 bio_src->bi_max_vecs * sizeof(struct bio_vec)); 263 bio_src->bi_max_vecs * sizeof(struct bio_vec));
@@ -303,7 +303,7 @@ struct bio *bio_clone(struct bio *bio, gfp_t gfp_mask)
303 */ 303 */
304int bio_get_nr_vecs(struct block_device *bdev) 304int bio_get_nr_vecs(struct block_device *bdev)
305{ 305{
306 request_queue_t *q = bdev_get_queue(bdev); 306 struct request_queue *q = bdev_get_queue(bdev);
307 int nr_pages; 307 int nr_pages;
308 308
309 nr_pages = ((q->max_sectors << 9) + PAGE_SIZE - 1) >> PAGE_SHIFT; 309 nr_pages = ((q->max_sectors << 9) + PAGE_SIZE - 1) >> PAGE_SHIFT;
@@ -315,7 +315,7 @@ int bio_get_nr_vecs(struct block_device *bdev)
315 return nr_pages; 315 return nr_pages;
316} 316}
317 317
318static int __bio_add_page(request_queue_t *q, struct bio *bio, struct page 318static int __bio_add_page(struct request_queue *q, struct bio *bio, struct page
319 *page, unsigned int len, unsigned int offset, 319 *page, unsigned int len, unsigned int offset,
320 unsigned short max_sectors) 320 unsigned short max_sectors)
321{ 321{
@@ -425,7 +425,7 @@ static int __bio_add_page(request_queue_t *q, struct bio *bio, struct page
425 * smaller than PAGE_SIZE, so it is always possible to add a single 425 * smaller than PAGE_SIZE, so it is always possible to add a single
426 * page to an empty bio. This should only be used by REQ_PC bios. 426 * page to an empty bio. This should only be used by REQ_PC bios.
427 */ 427 */
428int bio_add_pc_page(request_queue_t *q, struct bio *bio, struct page *page, 428int bio_add_pc_page(struct request_queue *q, struct bio *bio, struct page *page,
429 unsigned int len, unsigned int offset) 429 unsigned int len, unsigned int offset)
430{ 430{
431 return __bio_add_page(q, bio, page, len, offset, q->max_hw_sectors); 431 return __bio_add_page(q, bio, page, len, offset, q->max_hw_sectors);
@@ -523,7 +523,7 @@ int bio_uncopy_user(struct bio *bio)
523 * to/from kernel pages as necessary. Must be paired with 523 * to/from kernel pages as necessary. Must be paired with
524 * call bio_uncopy_user() on io completion. 524 * call bio_uncopy_user() on io completion.
525 */ 525 */
526struct bio *bio_copy_user(request_queue_t *q, unsigned long uaddr, 526struct bio *bio_copy_user(struct request_queue *q, unsigned long uaddr,
527 unsigned int len, int write_to_vm) 527 unsigned int len, int write_to_vm)
528{ 528{
529 unsigned long end = (uaddr + len + PAGE_SIZE - 1) >> PAGE_SHIFT; 529 unsigned long end = (uaddr + len + PAGE_SIZE - 1) >> PAGE_SHIFT;
@@ -600,7 +600,7 @@ out_bmd:
600 return ERR_PTR(ret); 600 return ERR_PTR(ret);
601} 601}
602 602
603static struct bio *__bio_map_user_iov(request_queue_t *q, 603static struct bio *__bio_map_user_iov(struct request_queue *q,
604 struct block_device *bdev, 604 struct block_device *bdev,
605 struct sg_iovec *iov, int iov_count, 605 struct sg_iovec *iov, int iov_count,
606 int write_to_vm) 606 int write_to_vm)
@@ -712,7 +712,7 @@ static struct bio *__bio_map_user_iov(request_queue_t *q,
712 712
713/** 713/**
714 * bio_map_user - map user address into bio 714 * bio_map_user - map user address into bio
715 * @q: the request_queue_t for the bio 715 * @q: the struct request_queue for the bio
716 * @bdev: destination block device 716 * @bdev: destination block device
717 * @uaddr: start of user address 717 * @uaddr: start of user address
718 * @len: length in bytes 718 * @len: length in bytes
@@ -721,7 +721,7 @@ static struct bio *__bio_map_user_iov(request_queue_t *q,
721 * Map the user space address into a bio suitable for io to a block 721 * Map the user space address into a bio suitable for io to a block
722 * device. Returns an error pointer in case of error. 722 * device. Returns an error pointer in case of error.
723 */ 723 */
724struct bio *bio_map_user(request_queue_t *q, struct block_device *bdev, 724struct bio *bio_map_user(struct request_queue *q, struct block_device *bdev,
725 unsigned long uaddr, unsigned int len, int write_to_vm) 725 unsigned long uaddr, unsigned int len, int write_to_vm)
726{ 726{
727 struct sg_iovec iov; 727 struct sg_iovec iov;
@@ -734,7 +734,7 @@ struct bio *bio_map_user(request_queue_t *q, struct block_device *bdev,
734 734
735/** 735/**
736 * bio_map_user_iov - map user sg_iovec table into bio 736 * bio_map_user_iov - map user sg_iovec table into bio
737 * @q: the request_queue_t for the bio 737 * @q: the struct request_queue for the bio
738 * @bdev: destination block device 738 * @bdev: destination block device
739 * @iov: the iovec. 739 * @iov: the iovec.
740 * @iov_count: number of elements in the iovec 740 * @iov_count: number of elements in the iovec
@@ -743,7 +743,7 @@ struct bio *bio_map_user(request_queue_t *q, struct block_device *bdev,
743 * Map the user space address into a bio suitable for io to a block 743 * Map the user space address into a bio suitable for io to a block
744 * device. Returns an error pointer in case of error. 744 * device. Returns an error pointer in case of error.
745 */ 745 */
746struct bio *bio_map_user_iov(request_queue_t *q, struct block_device *bdev, 746struct bio *bio_map_user_iov(struct request_queue *q, struct block_device *bdev,
747 struct sg_iovec *iov, int iov_count, 747 struct sg_iovec *iov, int iov_count,
748 int write_to_vm) 748 int write_to_vm)
749{ 749{
@@ -808,7 +808,7 @@ static int bio_map_kern_endio(struct bio *bio, unsigned int bytes_done, int err)
808} 808}
809 809
810 810
811static struct bio *__bio_map_kern(request_queue_t *q, void *data, 811static struct bio *__bio_map_kern(struct request_queue *q, void *data,
812 unsigned int len, gfp_t gfp_mask) 812 unsigned int len, gfp_t gfp_mask)
813{ 813{
814 unsigned long kaddr = (unsigned long)data; 814 unsigned long kaddr = (unsigned long)data;
@@ -847,7 +847,7 @@ static struct bio *__bio_map_kern(request_queue_t *q, void *data,
847 847
848/** 848/**
849 * bio_map_kern - map kernel address into bio 849 * bio_map_kern - map kernel address into bio
850 * @q: the request_queue_t for the bio 850 * @q: the struct request_queue for the bio
851 * @data: pointer to buffer to map 851 * @data: pointer to buffer to map
852 * @len: length in bytes 852 * @len: length in bytes
853 * @gfp_mask: allocation flags for bio allocation 853 * @gfp_mask: allocation flags for bio allocation
@@ -855,7 +855,7 @@ static struct bio *__bio_map_kern(request_queue_t *q, void *data,
855 * Map the kernel address into a bio suitable for io to a block 855 * Map the kernel address into a bio suitable for io to a block
856 * device. Returns an error pointer in case of error. 856 * device. Returns an error pointer in case of error.
857 */ 857 */
858struct bio *bio_map_kern(request_queue_t *q, void *data, unsigned int len, 858struct bio *bio_map_kern(struct request_queue *q, void *data, unsigned int len,
859 gfp_t gfp_mask) 859 gfp_t gfp_mask)
860{ 860{
861 struct bio *bio; 861 struct bio *bio;
diff --git a/fs/compat_ioctl.c b/fs/compat_ioctl.c
index e440a7b95d02..2bc1428d621c 100644
--- a/fs/compat_ioctl.c
+++ b/fs/compat_ioctl.c
@@ -115,6 +115,10 @@
115#include <linux/dvb/video.h> 115#include <linux/dvb/video.h>
116#include <linux/lp.h> 116#include <linux/lp.h>
117 117
118#ifdef CONFIG_SPARC
119#include <asm/fbio.h>
120#endif
121
118static int do_ioctl32_pointer(unsigned int fd, unsigned int cmd, 122static int do_ioctl32_pointer(unsigned int fd, unsigned int cmd,
119 unsigned long arg, struct file *f) 123 unsigned long arg, struct file *f)
120{ 124{
@@ -3493,6 +3497,22 @@ IGNORE_IOCTL(VFAT_IOCTL_READDIR_SHORT32)
3493 3497
3494/* loop */ 3498/* loop */
3495IGNORE_IOCTL(LOOP_CLR_FD) 3499IGNORE_IOCTL(LOOP_CLR_FD)
3500
3501#ifdef CONFIG_SPARC
3502/* Sparc framebuffers, handled in sbusfb_compat_ioctl() */
3503IGNORE_IOCTL(FBIOGTYPE)
3504IGNORE_IOCTL(FBIOSATTR)
3505IGNORE_IOCTL(FBIOGATTR)
3506IGNORE_IOCTL(FBIOSVIDEO)
3507IGNORE_IOCTL(FBIOGVIDEO)
3508IGNORE_IOCTL(FBIOSCURPOS)
3509IGNORE_IOCTL(FBIOGCURPOS)
3510IGNORE_IOCTL(FBIOGCURMAX)
3511IGNORE_IOCTL(FBIOPUTCMAP32)
3512IGNORE_IOCTL(FBIOGETCMAP32)
3513IGNORE_IOCTL(FBIOSCURSOR32)
3514IGNORE_IOCTL(FBIOGCURSOR32)
3515#endif
3496}; 3516};
3497 3517
3498#define IOCTL_HASHSIZE 256 3518#define IOCTL_HASHSIZE 256
diff --git a/fs/dcookies.c b/fs/dcookies.c
index c1208f53bd74..792cbf55fa95 100644
--- a/fs/dcookies.c
+++ b/fs/dcookies.c
@@ -20,6 +20,7 @@
20#include <linux/capability.h> 20#include <linux/capability.h>
21#include <linux/dcache.h> 21#include <linux/dcache.h>
22#include <linux/mm.h> 22#include <linux/mm.h>
23#include <linux/err.h>
23#include <linux/errno.h> 24#include <linux/errno.h>
24#include <linux/dcookies.h> 25#include <linux/dcookies.h>
25#include <linux/mutex.h> 26#include <linux/mutex.h>
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 68579a0ed3f0..639a32c3c9c1 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -580,7 +580,7 @@ static int ext2_check_descriptors (struct super_block * sb)
580 return 0; 580 return 0;
581 } 581 }
582 if (le32_to_cpu(gdp->bg_inode_table) < first_block || 582 if (le32_to_cpu(gdp->bg_inode_table) < first_block ||
583 le32_to_cpu(gdp->bg_inode_table) + sbi->s_itb_per_group > 583 le32_to_cpu(gdp->bg_inode_table) + sbi->s_itb_per_group - 1 >
584 last_block) 584 last_block)
585 { 585 {
586 ext2_error (sb, "ext2_check_descriptors", 586 ext2_error (sb, "ext2_check_descriptors",
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index f0614e3f1fe8..22cfdd61c060 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -1221,7 +1221,7 @@ static int ext3_check_descriptors (struct super_block * sb)
1221 return 0; 1221 return 0;
1222 } 1222 }
1223 if (le32_to_cpu(gdp->bg_inode_table) < first_block || 1223 if (le32_to_cpu(gdp->bg_inode_table) < first_block ||
1224 le32_to_cpu(gdp->bg_inode_table) + sbi->s_itb_per_group > 1224 le32_to_cpu(gdp->bg_inode_table) + sbi->s_itb_per_group - 1 >
1225 last_block) 1225 last_block)
1226 { 1226 {
1227 ext3_error (sb, "ext3_check_descriptors", 1227 ext3_error (sb, "ext3_check_descriptors",
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 750c46f7d893..78beb096f57d 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -1544,7 +1544,7 @@ int ext4_ext_walk_space(struct inode *inode, unsigned long block,
1544 1544
1545static void 1545static void
1546ext4_ext_put_in_cache(struct inode *inode, __u32 block, 1546ext4_ext_put_in_cache(struct inode *inode, __u32 block,
1547 __u32 len, __u32 start, int type) 1547 __u32 len, ext4_fsblk_t start, int type)
1548{ 1548{
1549 struct ext4_ext_cache *cex; 1549 struct ext4_ext_cache *cex;
1550 BUG_ON(len == 0); 1550 BUG_ON(len == 0);
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 75adbb64e028..4550b83ab1c9 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -1283,7 +1283,7 @@ static int ext4_check_descriptors (struct super_block * sb)
1283 } 1283 }
1284 inode_table = ext4_inode_table(sb, gdp); 1284 inode_table = ext4_inode_table(sb, gdp);
1285 if (inode_table < first_block || 1285 if (inode_table < first_block ||
1286 inode_table + sbi->s_itb_per_group > last_block) 1286 inode_table + sbi->s_itb_per_group - 1 > last_block)
1287 { 1287 {
1288 ext4_error (sb, "ext4_check_descriptors", 1288 ext4_error (sb, "ext4_check_descriptors",
1289 "Inode table for group %d" 1289 "Inode table for group %d"
diff --git a/fs/gfs2/ops_file.c b/fs/gfs2/ops_file.c
index 1a5e8e893d75..773421130116 100644
--- a/fs/gfs2/ops_file.c
+++ b/fs/gfs2/ops_file.c
@@ -508,7 +508,7 @@ static int gfs2_setlease(struct file *file, long arg, struct file_lock **fl)
508 */ 508 */
509 if (!sdp->sd_args.ar_localflocks) 509 if (!sdp->sd_args.ar_localflocks)
510 return -EINVAL; 510 return -EINVAL;
511 return setlease(file, arg, fl); 511 return generic_setlease(file, arg, fl);
512} 512}
513 513
514/** 514/**
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index 95c72aa81867..043b470fd3b6 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -846,6 +846,15 @@ root_found:
846 goto out_no_root; 846 goto out_no_root;
847 if (!inode->i_op) 847 if (!inode->i_op)
848 goto out_bad_root; 848 goto out_bad_root;
849
850 /* Make sure the root inode is a directory */
851 if (!S_ISDIR(inode->i_mode)) {
852 printk(KERN_WARNING
853 "isofs_fill_super: root inode is not a directory. "
854 "Corrupted media?\n");
855 goto out_iput;
856 }
857
849 /* get the root dentry */ 858 /* get the root dentry */
850 s->s_root = d_alloc_root(inode); 859 s->s_root = d_alloc_root(inode);
851 if (!(s->s_root)) 860 if (!(s->s_root))
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c
index b3efa4536cc5..a21e4bc5444b 100644
--- a/fs/lockd/svclock.c
+++ b/fs/lockd/svclock.c
@@ -335,10 +335,10 @@ static void nlmsvc_freegrantargs(struct nlm_rqst *call)
335/* 335/*
336 * Deferred lock request handling for non-blocking lock 336 * Deferred lock request handling for non-blocking lock
337 */ 337 */
338static u32 338static __be32
339nlmsvc_defer_lock_rqst(struct svc_rqst *rqstp, struct nlm_block *block) 339nlmsvc_defer_lock_rqst(struct svc_rqst *rqstp, struct nlm_block *block)
340{ 340{
341 u32 status = nlm_lck_denied_nolocks; 341 __be32 status = nlm_lck_denied_nolocks;
342 342
343 block->b_flags |= B_QUEUED; 343 block->b_flags |= B_QUEUED;
344 344
@@ -352,7 +352,7 @@ nlmsvc_defer_lock_rqst(struct svc_rqst *rqstp, struct nlm_block *block)
352 status = nlm_drop_reply; 352 status = nlm_drop_reply;
353 } 353 }
354 dprintk("lockd: nlmsvc_defer_lock_rqst block %p flags %d status %d\n", 354 dprintk("lockd: nlmsvc_defer_lock_rqst block %p flags %d status %d\n",
355 block, block->b_flags, status); 355 block, block->b_flags, ntohl(status));
356 356
357 return status; 357 return status;
358} 358}
diff --git a/fs/locks.c b/fs/locks.c
index 310510637247..50857d2d3404 100644
--- a/fs/locks.c
+++ b/fs/locks.c
@@ -1324,7 +1324,7 @@ int fcntl_getlease(struct file *filp)
1324} 1324}
1325 1325
1326/** 1326/**
1327 * setlease - sets a lease on an open file 1327 * generic_setlease - sets a lease on an open file
1328 * @filp: file pointer 1328 * @filp: file pointer
1329 * @arg: type of lease to obtain 1329 * @arg: type of lease to obtain
1330 * @flp: input - file_lock to use, output - file_lock inserted 1330 * @flp: input - file_lock to use, output - file_lock inserted
@@ -1334,7 +1334,7 @@ int fcntl_getlease(struct file *filp)
1334 * 1334 *
1335 * Called with kernel lock held. 1335 * Called with kernel lock held.
1336 */ 1336 */
1337int setlease(struct file *filp, long arg, struct file_lock **flp) 1337int generic_setlease(struct file *filp, long arg, struct file_lock **flp)
1338{ 1338{
1339 struct file_lock *fl, **before, **my_before = NULL, *lease; 1339 struct file_lock *fl, **before, **my_before = NULL, *lease;
1340 struct dentry *dentry = filp->f_path.dentry; 1340 struct dentry *dentry = filp->f_path.dentry;
@@ -1419,7 +1419,7 @@ int setlease(struct file *filp, long arg, struct file_lock **flp)
1419out: 1419out:
1420 return error; 1420 return error;
1421} 1421}
1422EXPORT_SYMBOL(setlease); 1422EXPORT_SYMBOL(generic_setlease);
1423 1423
1424 /** 1424 /**
1425 * vfs_setlease - sets a lease on an open file 1425 * vfs_setlease - sets a lease on an open file
@@ -1456,7 +1456,7 @@ int vfs_setlease(struct file *filp, long arg, struct file_lock **lease)
1456 if (filp->f_op && filp->f_op->setlease) 1456 if (filp->f_op && filp->f_op->setlease)
1457 error = filp->f_op->setlease(filp, arg, lease); 1457 error = filp->f_op->setlease(filp, arg, lease);
1458 else 1458 else
1459 error = setlease(filp, arg, lease); 1459 error = generic_setlease(filp, arg, lease);
1460 unlock_kernel(); 1460 unlock_kernel();
1461 1461
1462 return error; 1462 return error;
diff --git a/fs/ncpfs/ncplib_kernel.c b/fs/ncpfs/ncplib_kernel.c
index 551e0bac7aac..df6d60bdfcd3 100644
--- a/fs/ncpfs/ncplib_kernel.c
+++ b/fs/ncpfs/ncplib_kernel.c
@@ -726,9 +726,6 @@ ncp_del_file_or_subdir2(struct ncp_server *server,
726 __le32 dirent; 726 __le32 dirent;
727 727
728 if (!inode) { 728 if (!inode) {
729#ifdef CONFIG_NCPFS_DEBUGDENTRY
730 PRINTK("ncpfs: ncpdel2: dentry->d_inode == NULL\n");
731#endif
732 return 0xFF; /* Any error */ 729 return 0xFF; /* Any error */
733 } 730 }
734 volnum = NCP_FINFO(inode)->volNumber; 731 volnum = NCP_FINFO(inode)->volNumber;
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index 2d295dda4c1d..cba899a3494e 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -564,9 +564,10 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
564 564
565 /* flags */ 565 /* flags */
566 err = get_int(&mesg, &an_int); 566 err = get_int(&mesg, &an_int);
567 if (err == -ENOENT) 567 if (err == -ENOENT) {
568 err = 0;
568 set_bit(CACHE_NEGATIVE, &exp.h.flags); 569 set_bit(CACHE_NEGATIVE, &exp.h.flags);
569 else { 570 } else {
570 if (err || an_int < 0) goto out; 571 if (err || an_int < 0) goto out;
571 exp.ex_flags= an_int; 572 exp.ex_flags= an_int;
572 573
diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c
index 2cf9a9a2d89c..2ccffde81b84 100644
--- a/fs/nfsd/nfs4idmap.c
+++ b/fs/nfsd/nfs4idmap.c
@@ -138,7 +138,7 @@ idtoname_request(struct cache_detail *cd, struct cache_head *ch, char **bpp,
138 char idstr[11]; 138 char idstr[11];
139 139
140 qword_add(bpp, blen, ent->authname); 140 qword_add(bpp, blen, ent->authname);
141 snprintf(idstr, sizeof(idstr), "%d", ent->id); 141 snprintf(idstr, sizeof(idstr), "%u", ent->id);
142 qword_add(bpp, blen, ent->type == IDMAP_TYPE_GROUP ? "group" : "user"); 142 qword_add(bpp, blen, ent->type == IDMAP_TYPE_GROUP ? "group" : "user");
143 qword_add(bpp, blen, idstr); 143 qword_add(bpp, blen, idstr);
144 144
@@ -165,7 +165,7 @@ idtoname_show(struct seq_file *m, struct cache_detail *cd, struct cache_head *h)
165 return 0; 165 return 0;
166 } 166 }
167 ent = container_of(h, struct ent, h); 167 ent = container_of(h, struct ent, h);
168 seq_printf(m, "%s %s %d", ent->authname, 168 seq_printf(m, "%s %s %u", ent->authname,
169 ent->type == IDMAP_TYPE_GROUP ? "group" : "user", 169 ent->type == IDMAP_TYPE_GROUP ? "group" : "user",
170 ent->id); 170 ent->id);
171 if (test_bit(CACHE_VALID, &h->flags)) 171 if (test_bit(CACHE_VALID, &h->flags))
@@ -349,7 +349,7 @@ nametoid_show(struct seq_file *m, struct cache_detail *cd, struct cache_head *h)
349 ent->type == IDMAP_TYPE_GROUP ? "group" : "user", 349 ent->type == IDMAP_TYPE_GROUP ? "group" : "user",
350 ent->name); 350 ent->name);
351 if (test_bit(CACHE_VALID, &h->flags)) 351 if (test_bit(CACHE_VALID, &h->flags))
352 seq_printf(m, " %d", ent->id); 352 seq_printf(m, " %u", ent->id);
353 seq_printf(m, "\n"); 353 seq_printf(m, "\n");
354 return 0; 354 return 0;
355} 355}
diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index 3c627128e205..29b7e63cb32c 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -100,7 +100,15 @@ do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_o
100 status = nfsd_create_v3(rqstp, current_fh, open->op_fname.data, 100 status = nfsd_create_v3(rqstp, current_fh, open->op_fname.data,
101 open->op_fname.len, &open->op_iattr, 101 open->op_fname.len, &open->op_iattr,
102 &resfh, open->op_createmode, 102 &resfh, open->op_createmode,
103 (u32 *)open->op_verf.data, &open->op_truncate, &created); 103 (u32 *)open->op_verf.data,
104 &open->op_truncate, &created);
105
106 /* If we ever decide to use different attrs to store the
107 * verifier in nfsd_create_v3, then we'll need to change this
108 */
109 if (open->op_createmode == NFS4_CREATE_EXCLUSIVE && status == 0)
110 open->op_bmval[1] |= (FATTR4_WORD1_TIME_ACCESS |
111 FATTR4_WORD1_TIME_MODIFY);
104 } else { 112 } else {
105 status = nfsd_lookup(rqstp, current_fh, 113 status = nfsd_lookup(rqstp, current_fh,
106 open->op_fname.data, open->op_fname.len, &resfh); 114 open->op_fname.data, open->op_fname.len, &resfh);
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index b3d55c6747fd..8ef0964179bc 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -2450,7 +2450,7 @@ nfsd4_encode_rename(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_
2450} 2450}
2451 2451
2452static void 2452static void
2453nfsd4_encode_secinfo(struct nfsd4_compoundres *resp, int nfserr, 2453nfsd4_encode_secinfo(struct nfsd4_compoundres *resp, __be32 nfserr,
2454 struct nfsd4_secinfo *secinfo) 2454 struct nfsd4_secinfo *secinfo)
2455{ 2455{
2456 int i = 0; 2456 int i = 0;
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index ee96a897a29e..a0c2b253818b 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -1309,7 +1309,10 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
1309 1309
1310 if (createmode == NFS3_CREATE_EXCLUSIVE) { 1310 if (createmode == NFS3_CREATE_EXCLUSIVE) {
1311 /* solaris7 gets confused (bugid 4218508) if these have 1311 /* solaris7 gets confused (bugid 4218508) if these have
1312 * the high bit set, so just clear the high bits. 1312 * the high bit set, so just clear the high bits. If this is
1313 * ever changed to use different attrs for storing the
1314 * verifier, then do_open_lookup() will also need to be fixed
1315 * accordingly.
1313 */ 1316 */
1314 v_mtime = verifier[0]&0x7fffffff; 1317 v_mtime = verifier[0]&0x7fffffff;
1315 v_atime = verifier[1]&0x7fffffff; 1318 v_atime = verifier[1]&0x7fffffff;
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index 5727cd18302a..c4034f693e7b 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -2153,7 +2153,7 @@ static int ocfs2_splice_write_actor(struct pipe_inode_info *pipe,
2153 src = buf->ops->map(pipe, buf, 1); 2153 src = buf->ops->map(pipe, buf, 1);
2154 dst = kmap_atomic(page, KM_USER1); 2154 dst = kmap_atomic(page, KM_USER1);
2155 memcpy(dst + offset, src + buf->offset, count); 2155 memcpy(dst + offset, src + buf->offset, count);
2156 kunmap_atomic(page, KM_USER1); 2156 kunmap_atomic(dst, KM_USER1);
2157 buf->ops->unmap(pipe, buf, src); 2157 buf->ops->unmap(pipe, buf, src);
2158 2158
2159 copied = ocfs2_write_end(file, file->f_mapping, sd->pos, count, count, 2159 copied = ocfs2_write_end(file, file->f_mapping, sd->pos, count, count,
diff --git a/fs/open.c b/fs/open.c
index a6b054edacba..1d9e5e98bf4e 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -256,24 +256,26 @@ static long do_sys_truncate(const char __user * path, loff_t length)
256 if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) 256 if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
257 goto dput_and_out; 257 goto dput_and_out;
258 258
259 /* 259 error = get_write_access(inode);
260 * Make sure that there are no leases.
261 */
262 error = break_lease(inode, FMODE_WRITE);
263 if (error) 260 if (error)
264 goto dput_and_out; 261 goto dput_and_out;
265 262
266 error = get_write_access(inode); 263 /*
264 * Make sure that there are no leases. get_write_access() protects
265 * against the truncate racing with a lease-granting setlease().
266 */
267 error = break_lease(inode, FMODE_WRITE);
267 if (error) 268 if (error)
268 goto dput_and_out; 269 goto put_write_and_out;
269 270
270 error = locks_verify_truncate(inode, NULL, length); 271 error = locks_verify_truncate(inode, NULL, length);
271 if (!error) { 272 if (!error) {
272 DQUOT_INIT(inode); 273 DQUOT_INIT(inode);
273 error = do_truncate(nd.dentry, length, 0, NULL); 274 error = do_truncate(nd.dentry, length, 0, NULL);
274 } 275 }
275 put_write_access(inode);
276 276
277put_write_and_out:
278 put_write_access(inode);
277dput_and_out: 279dput_and_out:
278 path_release(&nd); 280 path_release(&nd);
279out: 281out:
@@ -403,7 +405,7 @@ asmlinkage long sys_fallocate(int fd, int mode, loff_t offset, loff_t len)
403 if (inode->i_op && inode->i_op->fallocate) 405 if (inode->i_op && inode->i_op->fallocate)
404 ret = inode->i_op->fallocate(inode, mode, offset, len); 406 ret = inode->i_op->fallocate(inode, mode, offset, len);
405 else 407 else
406 ret = -ENOSYS; 408 ret = -EOPNOTSUPP;
407 409
408out_fput: 410out_fput:
409 fput(file); 411 fput(file);
diff --git a/fs/partitions/msdos.c b/fs/partitions/msdos.c
index 4ccec4cd1367..5567ec0d03a3 100644
--- a/fs/partitions/msdos.c
+++ b/fs/partitions/msdos.c
@@ -203,6 +203,7 @@ parse_solaris_x86(struct parsed_partitions *state, struct block_device *bdev,
203 Sector sect; 203 Sector sect;
204 struct solaris_x86_vtoc *v; 204 struct solaris_x86_vtoc *v;
205 int i; 205 int i;
206 short max_nparts;
206 207
207 v = (struct solaris_x86_vtoc *)read_dev_sector(bdev, offset+1, &sect); 208 v = (struct solaris_x86_vtoc *)read_dev_sector(bdev, offset+1, &sect);
208 if (!v) 209 if (!v)
@@ -218,7 +219,9 @@ parse_solaris_x86(struct parsed_partitions *state, struct block_device *bdev,
218 put_dev_sector(sect); 219 put_dev_sector(sect);
219 return; 220 return;
220 } 221 }
221 for (i=0; i<SOLARIS_X86_NUMSLICE && state->next<state->limit; i++) { 222 /* Ensure we can handle previous case of VTOC with 8 entries gracefully */
223 max_nparts = le16_to_cpu (v->v_nparts) > 8 ? SOLARIS_X86_NUMSLICE : 8;
224 for (i=0; i<max_nparts && state->next<state->limit; i++) {
222 struct solaris_x86_slice *s = &v->v_slice[i]; 225 struct solaris_x86_slice *s = &v->v_slice[i];
223 if (s->s_size == 0) 226 if (s->s_size == 0)
224 continue; 227 continue;
diff --git a/fs/partitions/sun.c b/fs/partitions/sun.c
index 123f8b46c8ba..794118da4ef3 100644
--- a/fs/partitions/sun.c
+++ b/fs/partitions/sun.c
@@ -19,34 +19,47 @@ int sun_partition(struct parsed_partitions *state, struct block_device *bdev)
19 Sector sect; 19 Sector sect;
20 struct sun_disklabel { 20 struct sun_disklabel {
21 unsigned char info[128]; /* Informative text string */ 21 unsigned char info[128]; /* Informative text string */
22 unsigned char spare0[14]; 22 struct sun_vtoc {
23 struct sun_info { 23 __be32 version; /* Layout version */
24 unsigned char spare1; 24 char volume[8]; /* Volume name */
25 unsigned char id; 25 __be16 nparts; /* Number of partitions */
26 unsigned char spare2; 26 struct sun_info { /* Partition hdrs, sec 2 */
27 unsigned char flags; 27 __be16 id;
28 } infos[8]; 28 __be16 flags;
29 unsigned char spare[246]; /* Boot information etc. */ 29 } infos[8];
30 __be16 padding; /* Alignment padding */
31 __be32 bootinfo[3]; /* Info needed by mboot */
32 __be32 sanity; /* To verify vtoc sanity */
33 __be32 reserved[10]; /* Free space */
34 __be32 timestamp[8]; /* Partition timestamp */
35 } vtoc;
36 __be32 write_reinstruct; /* sectors to skip, writes */
37 __be32 read_reinstruct; /* sectors to skip, reads */
38 unsigned char spare[148]; /* Padding */
30 __be16 rspeed; /* Disk rotational speed */ 39 __be16 rspeed; /* Disk rotational speed */
31 __be16 pcylcount; /* Physical cylinder count */ 40 __be16 pcylcount; /* Physical cylinder count */
32 __be16 sparecyl; /* extra sects per cylinder */ 41 __be16 sparecyl; /* extra sects per cylinder */
33 unsigned char spare2[4]; /* More magic... */ 42 __be16 obs1; /* gap1 */
43 __be16 obs2; /* gap2 */
34 __be16 ilfact; /* Interleave factor */ 44 __be16 ilfact; /* Interleave factor */
35 __be16 ncyl; /* Data cylinder count */ 45 __be16 ncyl; /* Data cylinder count */
36 __be16 nacyl; /* Alt. cylinder count */ 46 __be16 nacyl; /* Alt. cylinder count */
37 __be16 ntrks; /* Tracks per cylinder */ 47 __be16 ntrks; /* Tracks per cylinder */
38 __be16 nsect; /* Sectors per track */ 48 __be16 nsect; /* Sectors per track */
39 unsigned char spare3[4]; /* Even more magic... */ 49 __be16 obs3; /* bhead - Label head offset */
50 __be16 obs4; /* ppart - Physical Partition */
40 struct sun_partition { 51 struct sun_partition {
41 __be32 start_cylinder; 52 __be32 start_cylinder;
42 __be32 num_sectors; 53 __be32 num_sectors;
43 } partitions[8]; 54 } partitions[8];
44 __be16 magic; /* Magic number */ 55 __be16 magic; /* Magic number */
45 __be16 csum; /* Label xor'd checksum */ 56 __be16 csum; /* Label xor'd checksum */
46 } * label; 57 } * label;
47 struct sun_partition *p; 58 struct sun_partition *p;
48 unsigned long spc; 59 unsigned long spc;
49 char b[BDEVNAME_SIZE]; 60 char b[BDEVNAME_SIZE];
61 int use_vtoc;
62 int nparts;
50 63
51 label = (struct sun_disklabel *)read_dev_sector(bdev, 0, &sect); 64 label = (struct sun_disklabel *)read_dev_sector(bdev, 0, &sect);
52 if (!label) 65 if (!label)
@@ -70,9 +83,22 @@ int sun_partition(struct parsed_partitions *state, struct block_device *bdev)
70 return 0; 83 return 0;
71 } 84 }
72 85
73 /* All Sun disks have 8 partition entries */ 86 /* Check to see if we can use the VTOC table */
87 use_vtoc = ((be32_to_cpu(label->vtoc.sanity) == SUN_VTOC_SANITY) &&
88 (be32_to_cpu(label->vtoc.version) == 1) &&
89 (be16_to_cpu(label->vtoc.nparts) <= 8));
90
91 /* Use 8 partition entries if not specified in validated VTOC */
92 nparts = (use_vtoc) ? be16_to_cpu(label->vtoc.nparts) : 8;
93
94 /*
95 * So that old Linux-Sun partitions continue to work,
96 * alow the VTOC to be used under the additional condition ...
97 */
98 use_vtoc = use_vtoc || !(label->vtoc.sanity |
99 label->vtoc.version | label->vtoc.nparts);
74 spc = be16_to_cpu(label->ntrks) * be16_to_cpu(label->nsect); 100 spc = be16_to_cpu(label->ntrks) * be16_to_cpu(label->nsect);
75 for (i = 0; i < 8; i++, p++) { 101 for (i = 0; i < nparts; i++, p++) {
76 unsigned long st_sector; 102 unsigned long st_sector;
77 unsigned int num_sectors; 103 unsigned int num_sectors;
78 104
@@ -81,10 +107,12 @@ int sun_partition(struct parsed_partitions *state, struct block_device *bdev)
81 if (num_sectors) { 107 if (num_sectors) {
82 put_partition(state, slot, st_sector, num_sectors); 108 put_partition(state, slot, st_sector, num_sectors);
83 state->parts[slot].flags = 0; 109 state->parts[slot].flags = 0;
84 if (label->infos[i].id == LINUX_RAID_PARTITION) 110 if (use_vtoc) {
85 state->parts[slot].flags |= ADDPART_FLAG_RAID; 111 if (be16_to_cpu(label->vtoc.infos[i].id) == LINUX_RAID_PARTITION)
86 if (label->infos[i].id == SUN_WHOLE_DISK) 112 state->parts[slot].flags |= ADDPART_FLAG_RAID;
87 state->parts[slot].flags |= ADDPART_FLAG_WHOLEDISK; 113 else if (be16_to_cpu(label->vtoc.infos[i].id) == SUN_WHOLE_DISK)
114 state->parts[slot].flags |= ADDPART_FLAG_WHOLEDISK;
115 }
88 } 116 }
89 slot++; 117 slot++;
90 } 118 }
diff --git a/fs/partitions/sun.h b/fs/partitions/sun.h
index b1b19fda7b22..7f864d1f86d4 100644
--- a/fs/partitions/sun.h
+++ b/fs/partitions/sun.h
@@ -3,5 +3,6 @@
3 */ 3 */
4 4
5#define SUN_LABEL_MAGIC 0xDABE 5#define SUN_LABEL_MAGIC 0xDABE
6#define SUN_VTOC_SANITY 0x600DDEEE
6 7
7int sun_partition(struct parsed_partitions *state, struct block_device *bdev); 8int sun_partition(struct parsed_partitions *state, struct block_device *bdev);
diff --git a/fs/pipe.c b/fs/pipe.c
index d007830d9c87..6b3d91a691bf 100644
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -255,7 +255,7 @@ void generic_pipe_buf_get(struct pipe_inode_info *pipe, struct pipe_buffer *buf)
255 255
256/** 256/**
257 * generic_pipe_buf_confirm - verify contents of the pipe buffer 257 * generic_pipe_buf_confirm - verify contents of the pipe buffer
258 * @pipe: the pipe that the buffer belongs to 258 * @info: the pipe that the buffer belongs to
259 * @buf: the buffer to confirm 259 * @buf: the buffer to confirm
260 * 260 *
261 * Description: 261 * Description:
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 3c77d5a64e7c..19489b0d5554 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -927,7 +927,7 @@ static const struct file_operations proc_pid_sched_operations = {
927 .read = seq_read, 927 .read = seq_read,
928 .write = sched_write, 928 .write = sched_write,
929 .llseek = seq_lseek, 929 .llseek = seq_lseek,
930 .release = seq_release, 930 .release = single_release,
931}; 931};
932 932
933#endif 933#endif
diff --git a/fs/proc/inode.c b/fs/proc/inode.c
index 94e2c1adf184..a5b0dfd89a17 100644
--- a/fs/proc/inode.c
+++ b/fs/proc/inode.c
@@ -386,6 +386,19 @@ static const struct file_operations proc_reg_file_ops = {
386 .release = proc_reg_release, 386 .release = proc_reg_release,
387}; 387};
388 388
389#ifdef CONFIG_COMPAT
390static const struct file_operations proc_reg_file_ops_no_compat = {
391 .llseek = proc_reg_llseek,
392 .read = proc_reg_read,
393 .write = proc_reg_write,
394 .poll = proc_reg_poll,
395 .unlocked_ioctl = proc_reg_unlocked_ioctl,
396 .mmap = proc_reg_mmap,
397 .open = proc_reg_open,
398 .release = proc_reg_release,
399};
400#endif
401
389struct inode *proc_get_inode(struct super_block *sb, unsigned int ino, 402struct inode *proc_get_inode(struct super_block *sb, unsigned int ino,
390 struct proc_dir_entry *de) 403 struct proc_dir_entry *de)
391{ 404{
@@ -413,8 +426,15 @@ struct inode *proc_get_inode(struct super_block *sb, unsigned int ino,
413 if (de->proc_iops) 426 if (de->proc_iops)
414 inode->i_op = de->proc_iops; 427 inode->i_op = de->proc_iops;
415 if (de->proc_fops) { 428 if (de->proc_fops) {
416 if (S_ISREG(inode->i_mode)) 429 if (S_ISREG(inode->i_mode)) {
417 inode->i_fop = &proc_reg_file_ops; 430#ifdef CONFIG_COMPAT
431 if (!de->proc_fops->compat_ioctl)
432 inode->i_fop =
433 &proc_reg_file_ops_no_compat;
434 else
435#endif
436 inode->i_fop = &proc_reg_file_ops;
437 }
418 else 438 else
419 inode->i_fop = de->proc_fops; 439 inode->i_fop = de->proc_fops;
420 } 440 }
diff --git a/fs/quota.c b/fs/quota.c
index e6577ac15a6c..99b24b52bfc8 100644
--- a/fs/quota.c
+++ b/fs/quota.c
@@ -387,7 +387,7 @@ asmlinkage long sys_quotactl(unsigned int cmd, const char __user *special, qid_t
387 return ret; 387 return ret;
388} 388}
389 389
390#if defined(CONFIG_X86_64) || defined(CONFIG_IA64) 390#if defined(CONFIG_COMPAT_FOR_U64_ALIGNMENT)
391/* 391/*
392 * This code works only for 32 bit quota tools over 64 bit OS (x86_64, ia64) 392 * This code works only for 32 bit quota tools over 64 bit OS (x86_64, ia64)
393 * and is necessary due to alignment problems. 393 * and is necessary due to alignment problems.
diff --git a/fs/ramfs/file-nommu.c b/fs/ramfs/file-nommu.c
index cad2b7ace630..237fe8b8e819 100644
--- a/fs/ramfs/file-nommu.c
+++ b/fs/ramfs/file-nommu.c
@@ -295,5 +295,10 @@ unsigned long ramfs_nommu_get_unmapped_area(struct file *file,
295 */ 295 */
296int ramfs_nommu_mmap(struct file *file, struct vm_area_struct *vma) 296int ramfs_nommu_mmap(struct file *file, struct vm_area_struct *vma)
297{ 297{
298 return vma->vm_flags & VM_SHARED ? 0 : -ENOSYS; 298 if (!(vma->vm_flags & VM_SHARED))
299 return -ENOSYS;
300
301 file_accessed(file);
302 vma->vm_ops = &generic_file_vm_ops;
303 return 0;
299} 304}
diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c
index b6f12593c39d..981027d1187b 100644
--- a/fs/reiserfs/stree.c
+++ b/fs/reiserfs/stree.c
@@ -1042,7 +1042,8 @@ static char prepare_for_delete_or_cut(struct reiserfs_transaction_handle *th, st
1042 pos = I_UNFM_NUM(&s_ih); 1042 pos = I_UNFM_NUM(&s_ih);
1043 1043
1044 while (le_ih_k_offset (&s_ih) + (pos - 1) * blk_size > n_new_file_length) { 1044 while (le_ih_k_offset (&s_ih) + (pos - 1) * blk_size > n_new_file_length) {
1045 __u32 *unfm, block; 1045 __le32 *unfm;
1046 __u32 block;
1046 1047
1047 /* Each unformatted block deletion may involve one additional 1048 /* Each unformatted block deletion may involve one additional
1048 * bitmap block into the transaction, thereby the initial 1049 * bitmap block into the transaction, thereby the initial
@@ -1052,7 +1053,7 @@ static char prepare_for_delete_or_cut(struct reiserfs_transaction_handle *th, st
1052 break; 1053 break;
1053 } 1054 }
1054 1055
1055 unfm = (__u32 *)B_I_PITEM(p_s_bh, &s_ih) + pos - 1; 1056 unfm = (__le32 *)B_I_PITEM(p_s_bh, &s_ih) + pos - 1;
1056 block = get_block_num(unfm, 0); 1057 block = get_block_num(unfm, 0);
1057 1058
1058 if (block != 0) { 1059 if (block != 0) {
diff --git a/fs/signalfd.c b/fs/signalfd.c
index 3b07f26d984d..7b941abbcde0 100644
--- a/fs/signalfd.c
+++ b/fs/signalfd.c
@@ -320,7 +320,7 @@ asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, size_t sizemas
320 320
321 if (sizemask != sizeof(sigset_t) || 321 if (sizemask != sizeof(sigset_t) ||
322 copy_from_user(&sigmask, user_mask, sizeof(sigmask))) 322 copy_from_user(&sigmask, user_mask, sizeof(sigmask)))
323 return error = -EINVAL; 323 return -EINVAL;
324 sigdelsetmask(&sigmask, sigmask(SIGKILL) | sigmask(SIGSTOP)); 324 sigdelsetmask(&sigmask, sigmask(SIGKILL) | sigmask(SIGSTOP));
325 signotset(&sigmask); 325 signotset(&sigmask);
326 326
diff --git a/fs/splice.c b/fs/splice.c
index 0a0973218084..c010a72ca2d2 100644
--- a/fs/splice.c
+++ b/fs/splice.c
@@ -164,7 +164,7 @@ static const struct pipe_buf_operations user_page_pipe_buf_ops = {
164 * @spd: data to fill 164 * @spd: data to fill
165 * 165 *
166 * Description: 166 * Description:
167 * @spd contains a map of pages and len/offset tupples, a long with 167 * @spd contains a map of pages and len/offset tuples, along with
168 * the struct pipe_buf_operations associated with these pages. This 168 * the struct pipe_buf_operations associated with these pages. This
169 * function will link that data to the pipe. 169 * function will link that data to the pipe.
170 * 170 *
@@ -1000,7 +1000,7 @@ static long do_splice_to(struct file *in, loff_t *ppos,
1000 * Description: 1000 * Description:
1001 * This is a special case helper to splice directly between two 1001 * This is a special case helper to splice directly between two
1002 * points, without requiring an explicit pipe. Internally an allocated 1002 * points, without requiring an explicit pipe. Internally an allocated
1003 * pipe is cached in the process, and reused during the life time of 1003 * pipe is cached in the process, and reused during the lifetime of
1004 * that process. 1004 * that process.
1005 * 1005 *
1006 */ 1006 */
diff --git a/fs/timerfd.c b/fs/timerfd.c
index af9eca5c0230..61983f3b107c 100644
--- a/fs/timerfd.c
+++ b/fs/timerfd.c
@@ -95,7 +95,7 @@ static ssize_t timerfd_read(struct file *file, char __user *buf, size_t count,
95{ 95{
96 struct timerfd_ctx *ctx = file->private_data; 96 struct timerfd_ctx *ctx = file->private_data;
97 ssize_t res; 97 ssize_t res;
98 u32 ticks = 0; 98 u64 ticks = 0;
99 DECLARE_WAITQUEUE(wait, current); 99 DECLARE_WAITQUEUE(wait, current);
100 100
101 if (count < sizeof(ticks)) 101 if (count < sizeof(ticks))
@@ -130,7 +130,7 @@ static ssize_t timerfd_read(struct file *file, char __user *buf, size_t count,
130 * callback to avoid DoS attacks specifying a very 130 * callback to avoid DoS attacks specifying a very
131 * short timer period. 131 * short timer period.
132 */ 132 */
133 ticks = (u32) 133 ticks = (u64)
134 hrtimer_forward(&ctx->tmr, 134 hrtimer_forward(&ctx->tmr,
135 hrtimer_cb_get_time(&ctx->tmr), 135 hrtimer_cb_get_time(&ctx->tmr),
136 ctx->tintv); 136 ctx->tintv);
@@ -140,7 +140,7 @@ static ssize_t timerfd_read(struct file *file, char __user *buf, size_t count,
140 } 140 }
141 spin_unlock_irq(&ctx->wqh.lock); 141 spin_unlock_irq(&ctx->wqh.lock);
142 if (ticks) 142 if (ticks)
143 res = put_user(ticks, buf) ? -EFAULT: sizeof(ticks); 143 res = put_user(ticks, (u64 __user *) buf) ? -EFAULT: sizeof(ticks);
144 return res; 144 return res;
145} 145}
146 146
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 0d2c41666cd2..1652b2c665bb 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -1127,13 +1127,15 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
1127 } 1127 }
1128 1128
1129 inode->i_uid = le32_to_cpu(fe->uid); 1129 inode->i_uid = le32_to_cpu(fe->uid);
1130 if (inode->i_uid == -1 || UDF_QUERY_FLAG(inode->i_sb, 1130 if (inode->i_uid == -1 ||
1131 UDF_FLAG_UID_IGNORE)) 1131 UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_IGNORE) ||
1132 UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_SET))
1132 inode->i_uid = UDF_SB(inode->i_sb)->s_uid; 1133 inode->i_uid = UDF_SB(inode->i_sb)->s_uid;
1133 1134
1134 inode->i_gid = le32_to_cpu(fe->gid); 1135 inode->i_gid = le32_to_cpu(fe->gid);
1135 if (inode->i_gid == -1 || UDF_QUERY_FLAG(inode->i_sb, 1136 if (inode->i_gid == -1 ||
1136 UDF_FLAG_GID_IGNORE)) 1137 UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_GID_IGNORE) ||
1138 UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_GID_SET))
1137 inode->i_gid = UDF_SB(inode->i_sb)->s_gid; 1139 inode->i_gid = UDF_SB(inode->i_sb)->s_gid;
1138 1140
1139 inode->i_nlink = le16_to_cpu(fe->fileLinkCount); 1141 inode->i_nlink = le16_to_cpu(fe->fileLinkCount);
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 7b30964665db..382be7be5ae3 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -366,11 +366,13 @@ static int udf_parse_options(char *options, struct udf_options *uopt)
366 if (match_int(args, &option)) 366 if (match_int(args, &option))
367 return 0; 367 return 0;
368 uopt->gid = option; 368 uopt->gid = option;
369 uopt->flags |= (1 << UDF_FLAG_GID_SET);
369 break; 370 break;
370 case Opt_uid: 371 case Opt_uid:
371 if (match_int(args, &option)) 372 if (match_int(args, &option))
372 return 0; 373 return 0;
373 uopt->uid = option; 374 uopt->uid = option;
375 uopt->flags |= (1 << UDF_FLAG_UID_SET);
374 break; 376 break;
375 case Opt_umask: 377 case Opt_umask:
376 if (match_octal(args, &option)) 378 if (match_octal(args, &option))
diff --git a/fs/udf/udf_sb.h b/fs/udf/udf_sb.h
index 3e937d3fb8f9..3c2982017c6d 100644
--- a/fs/udf/udf_sb.h
+++ b/fs/udf/udf_sb.h
@@ -24,6 +24,8 @@
24#define UDF_FLAG_UID_IGNORE 12 /* use sb uid instead of on disk uid */ 24#define UDF_FLAG_UID_IGNORE 12 /* use sb uid instead of on disk uid */
25#define UDF_FLAG_GID_FORGET 13 25#define UDF_FLAG_GID_FORGET 13
26#define UDF_FLAG_GID_IGNORE 14 26#define UDF_FLAG_GID_IGNORE 14
27#define UDF_FLAG_UID_SET 15
28#define UDF_FLAG_GID_SET 16
27 29
28#define UDF_PART_FLAG_UNALLOC_BITMAP 0x0001 30#define UDF_PART_FLAG_UNALLOC_BITMAP 0x0001
29#define UDF_PART_FLAG_UNALLOC_TABLE 0x0002 31#define UDF_PART_FLAG_UNALLOC_TABLE 0x0002
diff --git a/fs/xfs/linux-2.6/xfs_ioctl32.c b/fs/xfs/linux-2.6/xfs_ioctl32.c
index 141cf15067c2..42319d75aaab 100644
--- a/fs/xfs/linux-2.6/xfs_ioctl32.c
+++ b/fs/xfs/linux-2.6/xfs_ioctl32.c
@@ -139,7 +139,7 @@ STATIC int xfs_inumbers_fmt_compat(
139 long count, 139 long count,
140 long *written) 140 long *written)
141{ 141{
142 compat_xfs_inogrp_t *p32 = ubuffer; 142 compat_xfs_inogrp_t __user *p32 = ubuffer;
143 long i; 143 long i;
144 144
145 for (i = 0; i < count; i++) { 145 for (i = 0; i < count; i++) {
@@ -444,7 +444,7 @@ xfs_compat_ioctl(
444 case XFS_IOC_FSINUMBERS_32: 444 case XFS_IOC_FSINUMBERS_32:
445 cmd = _NATIVE_IOC(cmd, struct xfs_fsop_bulkreq); 445 cmd = _NATIVE_IOC(cmd, struct xfs_fsop_bulkreq);
446 return xfs_ioc_bulkstat_compat(XFS_BHVTOI(VNHEAD(vp))->i_mount, 446 return xfs_ioc_bulkstat_compat(XFS_BHVTOI(VNHEAD(vp))->i_mount,
447 cmd, (void*)arg); 447 cmd, (void __user*)arg);
448 case XFS_IOC_FD_TO_HANDLE_32: 448 case XFS_IOC_FD_TO_HANDLE_32:
449 case XFS_IOC_PATH_TO_HANDLE_32: 449 case XFS_IOC_PATH_TO_HANDLE_32:
450 case XFS_IOC_PATH_TO_FSHANDLE_32: 450 case XFS_IOC_PATH_TO_FSHANDLE_32: