aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/ecryptfs/inode.c4
-rw-r--r--fs/ecryptfs/mmap.c3
-rw-r--r--fs/hugetlbfs/inode.c15
-rw-r--r--fs/jffs2/fs.c2
-rw-r--r--fs/nfs/file.c2
-rw-r--r--fs/nfs/namespace.c2
-rw-r--r--fs/nfs/nfs4proc.c4
-rw-r--r--fs/nfs/super.c130
-rw-r--r--fs/nfs/write.c44
-rw-r--r--fs/udf/balloc.c10
-rw-r--r--fs/udf/super.c26
11 files changed, 161 insertions, 81 deletions
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index 5d40ad13ab..131954b3fb 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -357,10 +357,6 @@ static struct dentry *ecryptfs_lookup(struct inode *dir, struct dentry *dentry,
357 ecryptfs_printk(KERN_DEBUG, "Is a special file; returning\n"); 357 ecryptfs_printk(KERN_DEBUG, "Is a special file; returning\n");
358 goto out; 358 goto out;
359 } 359 }
360 if (special_file(lower_inode->i_mode)) {
361 ecryptfs_printk(KERN_DEBUG, "Is a special file; returning\n");
362 goto out;
363 }
364 if (!nd) { 360 if (!nd) {
365 ecryptfs_printk(KERN_DEBUG, "We have a NULL nd, just leave" 361 ecryptfs_printk(KERN_DEBUG, "We have a NULL nd, just leave"
366 "as we *think* we are about to unlink\n"); 362 "as we *think* we are about to unlink\n");
diff --git a/fs/ecryptfs/mmap.c b/fs/ecryptfs/mmap.c
index e4ab7bc14e..fd3f94d4a6 100644
--- a/fs/ecryptfs/mmap.c
+++ b/fs/ecryptfs/mmap.c
@@ -834,7 +834,8 @@ static void ecryptfs_sync_page(struct page *page)
834 ecryptfs_printk(KERN_DEBUG, "find_lock_page failed\n"); 834 ecryptfs_printk(KERN_DEBUG, "find_lock_page failed\n");
835 return; 835 return;
836 } 836 }
837 lower_page->mapping->a_ops->sync_page(lower_page); 837 if (lower_page->mapping->a_ops->sync_page)
838 lower_page->mapping->a_ops->sync_page(lower_page);
838 ecryptfs_printk(KERN_DEBUG, "Unlocking page with index = [0x%.16x]\n", 839 ecryptfs_printk(KERN_DEBUG, "Unlocking page with index = [0x%.16x]\n",
839 lower_page->index); 840 lower_page->index);
840 unlock_page(lower_page); 841 unlock_page(lower_page);
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index c848a19152..950c2fbb81 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -82,14 +82,19 @@ static int hugetlbfs_file_mmap(struct file *file, struct vm_area_struct *vma)
82 int ret; 82 int ret;
83 83
84 /* 84 /*
85 * vma alignment has already been checked by prepare_hugepage_range. 85 * vma address alignment (but not the pgoff alignment) has
86 * If you add any error returns here, do so after setting VM_HUGETLB, 86 * already been checked by prepare_hugepage_range. If you add
87 * so is_vm_hugetlb_page tests below unmap_region go the right way 87 * any error returns here, do so after setting VM_HUGETLB, so
88 * when do_mmap_pgoff unwinds (may be important on powerpc and ia64). 88 * is_vm_hugetlb_page tests below unmap_region go the right
89 * way when do_mmap_pgoff unwinds (may be important on powerpc
90 * and ia64).
89 */ 91 */
90 vma->vm_flags |= VM_HUGETLB | VM_RESERVED; 92 vma->vm_flags |= VM_HUGETLB | VM_RESERVED;
91 vma->vm_ops = &hugetlb_vm_ops; 93 vma->vm_ops = &hugetlb_vm_ops;
92 94
95 if (vma->vm_pgoff & ~(HPAGE_MASK >> PAGE_SHIFT))
96 return -EINVAL;
97
93 vma_len = (loff_t)(vma->vm_end - vma->vm_start); 98 vma_len = (loff_t)(vma->vm_end - vma->vm_start);
94 99
95 mutex_lock(&inode->i_mutex); 100 mutex_lock(&inode->i_mutex);
@@ -132,7 +137,7 @@ hugetlb_get_unmapped_area(struct file *file, unsigned long addr,
132 return -ENOMEM; 137 return -ENOMEM;
133 138
134 if (flags & MAP_FIXED) { 139 if (flags & MAP_FIXED) {
135 if (prepare_hugepage_range(addr, len, pgoff)) 140 if (prepare_hugepage_range(addr, len))
136 return -EINVAL; 141 return -EINVAL;
137 return addr; 142 return addr;
138 } 143 }
diff --git a/fs/jffs2/fs.c b/fs/jffs2/fs.c
index 1d3b7a9fc8..8bc727b716 100644
--- a/fs/jffs2/fs.c
+++ b/fs/jffs2/fs.c
@@ -627,7 +627,7 @@ unsigned char *jffs2_gc_fetch_page(struct jffs2_sb_info *c,
627 struct inode *inode = OFNI_EDONI_2SFFJ(f); 627 struct inode *inode = OFNI_EDONI_2SFFJ(f);
628 struct page *pg; 628 struct page *pg;
629 629
630 pg = read_cache_page(inode->i_mapping, offset >> PAGE_CACHE_SHIFT, 630 pg = read_cache_page_async(inode->i_mapping, offset >> PAGE_CACHE_SHIFT,
631 (void *)jffs2_do_readpage_unlock, inode); 631 (void *)jffs2_do_readpage_unlock, inode);
632 if (IS_ERR(pg)) 632 if (IS_ERR(pg))
633 return (void *)pg; 633 return (void *)pg;
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index c87dc713b5..579cf8a7d4 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -316,7 +316,7 @@ static void nfs_invalidate_page(struct page *page, unsigned long offset)
316 if (offset != 0) 316 if (offset != 0)
317 return; 317 return;
318 /* Cancel any unstarted writes on this page */ 318 /* Cancel any unstarted writes on this page */
319 nfs_wb_page_priority(page->mapping->host, page, FLUSH_INVALIDATE); 319 nfs_wb_page_cancel(page->mapping->host, page);
320} 320}
321 321
322static int nfs_release_page(struct page *page, gfp_t gfp) 322static int nfs_release_page(struct page *page, gfp_t gfp)
diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c
index aea76d0e5f..acfc56f9ed 100644
--- a/fs/nfs/namespace.c
+++ b/fs/nfs/namespace.c
@@ -176,7 +176,7 @@ static void nfs_expire_automounts(struct work_struct *work)
176void nfs_release_automount_timer(void) 176void nfs_release_automount_timer(void)
177{ 177{
178 if (list_empty(&nfs_automount_list)) 178 if (list_empty(&nfs_automount_list))
179 cancel_delayed_work_sync(&nfs_automount_task); 179 cancel_delayed_work(&nfs_automount_task);
180} 180}
181 181
182/* 182/*
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 62b3ae2803..4b90e17555 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -646,7 +646,7 @@ static int _nfs4_do_open_reclaim(struct nfs_open_context *ctx, struct nfs4_state
646 rcu_read_lock(); 646 rcu_read_lock();
647 delegation = rcu_dereference(NFS_I(state->inode)->delegation); 647 delegation = rcu_dereference(NFS_I(state->inode)->delegation);
648 if (delegation != NULL && (delegation->flags & NFS_DELEGATION_NEED_RECLAIM) != 0) 648 if (delegation != NULL && (delegation->flags & NFS_DELEGATION_NEED_RECLAIM) != 0)
649 delegation_type = delegation->flags; 649 delegation_type = delegation->type;
650 rcu_read_unlock(); 650 rcu_read_unlock();
651 opendata->o_arg.u.delegation_type = delegation_type; 651 opendata->o_arg.u.delegation_type = delegation_type;
652 status = nfs4_open_recover(opendata, state); 652 status = nfs4_open_recover(opendata, state);
@@ -1434,7 +1434,7 @@ nfs4_atomic_open(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
1434 } 1434 }
1435 res = d_add_unique(dentry, igrab(state->inode)); 1435 res = d_add_unique(dentry, igrab(state->inode));
1436 if (res != NULL) 1436 if (res != NULL)
1437 dentry = res; 1437 path.dentry = res;
1438 nfs4_intent_set_file(nd, &path, state); 1438 nfs4_intent_set_file(nd, &path, state);
1439 return res; 1439 return res;
1440} 1440}
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index b2a851c1b8..8ed593766f 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -911,13 +911,13 @@ static int nfs_parse_mount_options(char *raw,
911 kfree(string); 911 kfree(string);
912 912
913 switch (token) { 913 switch (token) {
914 case Opt_udp: 914 case Opt_xprt_udp:
915 mnt->flags &= ~NFS_MOUNT_TCP; 915 mnt->flags &= ~NFS_MOUNT_TCP;
916 mnt->nfs_server.protocol = IPPROTO_UDP; 916 mnt->nfs_server.protocol = IPPROTO_UDP;
917 mnt->timeo = 7; 917 mnt->timeo = 7;
918 mnt->retrans = 5; 918 mnt->retrans = 5;
919 break; 919 break;
920 case Opt_tcp: 920 case Opt_xprt_tcp:
921 mnt->flags |= NFS_MOUNT_TCP; 921 mnt->flags |= NFS_MOUNT_TCP;
922 mnt->nfs_server.protocol = IPPROTO_TCP; 922 mnt->nfs_server.protocol = IPPROTO_TCP;
923 mnt->timeo = 600; 923 mnt->timeo = 600;
@@ -936,10 +936,10 @@ static int nfs_parse_mount_options(char *raw,
936 kfree(string); 936 kfree(string);
937 937
938 switch (token) { 938 switch (token) {
939 case Opt_udp: 939 case Opt_xprt_udp:
940 mnt->mount_server.protocol = IPPROTO_UDP; 940 mnt->mount_server.protocol = IPPROTO_UDP;
941 break; 941 break;
942 case Opt_tcp: 942 case Opt_xprt_tcp:
943 mnt->mount_server.protocol = IPPROTO_TCP; 943 mnt->mount_server.protocol = IPPROTO_TCP;
944 break; 944 break;
945 default: 945 default:
@@ -1153,20 +1153,20 @@ static int nfs_validate_mount_data(struct nfs_mount_data **options,
1153 c = strchr(dev_name, ':'); 1153 c = strchr(dev_name, ':');
1154 if (c == NULL) 1154 if (c == NULL)
1155 return -EINVAL; 1155 return -EINVAL;
1156 len = c - dev_name - 1; 1156 len = c - dev_name;
1157 if (len > sizeof(data->hostname)) 1157 if (len > sizeof(data->hostname))
1158 return -EINVAL; 1158 return -ENAMETOOLONG;
1159 strncpy(data->hostname, dev_name, len); 1159 strncpy(data->hostname, dev_name, len);
1160 args.nfs_server.hostname = data->hostname; 1160 args.nfs_server.hostname = data->hostname;
1161 1161
1162 c++; 1162 c++;
1163 if (strlen(c) > NFS_MAXPATHLEN) 1163 if (strlen(c) > NFS_MAXPATHLEN)
1164 return -EINVAL; 1164 return -ENAMETOOLONG;
1165 args.nfs_server.export_path = c; 1165 args.nfs_server.export_path = c;
1166 1166
1167 status = nfs_try_mount(&args, mntfh); 1167 status = nfs_try_mount(&args, mntfh);
1168 if (status) 1168 if (status)
1169 return -EINVAL; 1169 return status;
1170 1170
1171 /* 1171 /*
1172 * Translate to nfs_mount_data, which nfs_fill_super 1172 * Translate to nfs_mount_data, which nfs_fill_super
@@ -1303,34 +1303,6 @@ static void nfs_clone_super(struct super_block *sb,
1303 nfs_initialise_sb(sb); 1303 nfs_initialise_sb(sb);
1304} 1304}
1305 1305
1306static int nfs_set_super(struct super_block *s, void *_server)
1307{
1308 struct nfs_server *server = _server;
1309 int ret;
1310
1311 s->s_fs_info = server;
1312 ret = set_anon_super(s, server);
1313 if (ret == 0)
1314 server->s_dev = s->s_dev;
1315 return ret;
1316}
1317
1318static int nfs_compare_super(struct super_block *sb, void *data)
1319{
1320 struct nfs_server *server = data, *old = NFS_SB(sb);
1321
1322 if (memcmp(&old->nfs_client->cl_addr,
1323 &server->nfs_client->cl_addr,
1324 sizeof(old->nfs_client->cl_addr)) != 0)
1325 return 0;
1326 /* Note: NFS_MOUNT_UNSHARED == NFS4_MOUNT_UNSHARED */
1327 if (old->flags & NFS_MOUNT_UNSHARED)
1328 return 0;
1329 if (memcmp(&old->fsid, &server->fsid, sizeof(old->fsid)) != 0)
1330 return 0;
1331 return 1;
1332}
1333
1334#define NFS_MS_MASK (MS_RDONLY|MS_NOSUID|MS_NODEV|MS_NOEXEC|MS_SYNCHRONOUS) 1306#define NFS_MS_MASK (MS_RDONLY|MS_NOSUID|MS_NODEV|MS_NOEXEC|MS_SYNCHRONOUS)
1335 1307
1336static int nfs_compare_mount_options(const struct super_block *s, const struct nfs_server *b, int flags) 1308static int nfs_compare_mount_options(const struct super_block *s, const struct nfs_server *b, int flags)
@@ -1359,9 +1331,46 @@ static int nfs_compare_mount_options(const struct super_block *s, const struct n
1359 goto Ebusy; 1331 goto Ebusy;
1360 if (clnt_a->cl_auth->au_flavor != clnt_b->cl_auth->au_flavor) 1332 if (clnt_a->cl_auth->au_flavor != clnt_b->cl_auth->au_flavor)
1361 goto Ebusy; 1333 goto Ebusy;
1362 return 0; 1334 return 1;
1363Ebusy: 1335Ebusy:
1364 return -EBUSY; 1336 return 0;
1337}
1338
1339struct nfs_sb_mountdata {
1340 struct nfs_server *server;
1341 int mntflags;
1342};
1343
1344static int nfs_set_super(struct super_block *s, void *data)
1345{
1346 struct nfs_sb_mountdata *sb_mntdata = data;
1347 struct nfs_server *server = sb_mntdata->server;
1348 int ret;
1349
1350 s->s_flags = sb_mntdata->mntflags;
1351 s->s_fs_info = server;
1352 ret = set_anon_super(s, server);
1353 if (ret == 0)
1354 server->s_dev = s->s_dev;
1355 return ret;
1356}
1357
1358static int nfs_compare_super(struct super_block *sb, void *data)
1359{
1360 struct nfs_sb_mountdata *sb_mntdata = data;
1361 struct nfs_server *server = sb_mntdata->server, *old = NFS_SB(sb);
1362 int mntflags = sb_mntdata->mntflags;
1363
1364 if (memcmp(&old->nfs_client->cl_addr,
1365 &server->nfs_client->cl_addr,
1366 sizeof(old->nfs_client->cl_addr)) != 0)
1367 return 0;
1368 /* Note: NFS_MOUNT_UNSHARED == NFS4_MOUNT_UNSHARED */
1369 if (old->flags & NFS_MOUNT_UNSHARED)
1370 return 0;
1371 if (memcmp(&old->fsid, &server->fsid, sizeof(old->fsid)) != 0)
1372 return 0;
1373 return nfs_compare_mount_options(sb, server, mntflags);
1365} 1374}
1366 1375
1367static int nfs_get_sb(struct file_system_type *fs_type, 1376static int nfs_get_sb(struct file_system_type *fs_type,
@@ -1373,6 +1382,9 @@ static int nfs_get_sb(struct file_system_type *fs_type,
1373 struct nfs_mount_data *data = raw_data; 1382 struct nfs_mount_data *data = raw_data;
1374 struct dentry *mntroot; 1383 struct dentry *mntroot;
1375 int (*compare_super)(struct super_block *, void *) = nfs_compare_super; 1384 int (*compare_super)(struct super_block *, void *) = nfs_compare_super;
1385 struct nfs_sb_mountdata sb_mntdata = {
1386 .mntflags = flags,
1387 };
1376 int error; 1388 int error;
1377 1389
1378 /* Validate the mount data */ 1390 /* Validate the mount data */
@@ -1386,28 +1398,25 @@ static int nfs_get_sb(struct file_system_type *fs_type,
1386 error = PTR_ERR(server); 1398 error = PTR_ERR(server);
1387 goto out; 1399 goto out;
1388 } 1400 }
1401 sb_mntdata.server = server;
1389 1402
1390 if (server->flags & NFS_MOUNT_UNSHARED) 1403 if (server->flags & NFS_MOUNT_UNSHARED)
1391 compare_super = NULL; 1404 compare_super = NULL;
1392 1405
1393 /* Get a superblock - note that we may end up sharing one that already exists */ 1406 /* Get a superblock - note that we may end up sharing one that already exists */
1394 s = sget(fs_type, compare_super, nfs_set_super, server); 1407 s = sget(fs_type, compare_super, nfs_set_super, &sb_mntdata);
1395 if (IS_ERR(s)) { 1408 if (IS_ERR(s)) {
1396 error = PTR_ERR(s); 1409 error = PTR_ERR(s);
1397 goto out_err_nosb; 1410 goto out_err_nosb;
1398 } 1411 }
1399 1412
1400 if (s->s_fs_info != server) { 1413 if (s->s_fs_info != server) {
1401 error = nfs_compare_mount_options(s, server, flags);
1402 nfs_free_server(server); 1414 nfs_free_server(server);
1403 server = NULL; 1415 server = NULL;
1404 if (error < 0)
1405 goto error_splat_super;
1406 } 1416 }
1407 1417
1408 if (!s->s_root) { 1418 if (!s->s_root) {
1409 /* initial superblock/root creation */ 1419 /* initial superblock/root creation */
1410 s->s_flags = flags;
1411 nfs_fill_super(s, data); 1420 nfs_fill_super(s, data);
1412 } 1421 }
1413 1422
@@ -1460,6 +1469,9 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags,
1460 struct nfs_server *server; 1469 struct nfs_server *server;
1461 struct dentry *mntroot; 1470 struct dentry *mntroot;
1462 int (*compare_super)(struct super_block *, void *) = nfs_compare_super; 1471 int (*compare_super)(struct super_block *, void *) = nfs_compare_super;
1472 struct nfs_sb_mountdata sb_mntdata = {
1473 .mntflags = flags,
1474 };
1463 int error; 1475 int error;
1464 1476
1465 dprintk("--> nfs_xdev_get_sb()\n"); 1477 dprintk("--> nfs_xdev_get_sb()\n");
@@ -1470,28 +1482,25 @@ static int nfs_xdev_get_sb(struct file_system_type *fs_type, int flags,
1470 error = PTR_ERR(server); 1482 error = PTR_ERR(server);
1471 goto out_err_noserver; 1483 goto out_err_noserver;
1472 } 1484 }
1485 sb_mntdata.server = server;
1473 1486
1474 if (server->flags & NFS_MOUNT_UNSHARED) 1487 if (server->flags & NFS_MOUNT_UNSHARED)
1475 compare_super = NULL; 1488 compare_super = NULL;
1476 1489
1477 /* Get a superblock - note that we may end up sharing one that already exists */ 1490 /* Get a superblock - note that we may end up sharing one that already exists */
1478 s = sget(&nfs_fs_type, compare_super, nfs_set_super, server); 1491 s = sget(&nfs_fs_type, compare_super, nfs_set_super, &sb_mntdata);
1479 if (IS_ERR(s)) { 1492 if (IS_ERR(s)) {
1480 error = PTR_ERR(s); 1493 error = PTR_ERR(s);
1481 goto out_err_nosb; 1494 goto out_err_nosb;
1482 } 1495 }
1483 1496
1484 if (s->s_fs_info != server) { 1497 if (s->s_fs_info != server) {
1485 error = nfs_compare_mount_options(s, server, flags);
1486 nfs_free_server(server); 1498 nfs_free_server(server);
1487 server = NULL; 1499 server = NULL;
1488 if (error < 0)
1489 goto error_splat_super;
1490 } 1500 }
1491 1501
1492 if (!s->s_root) { 1502 if (!s->s_root) {
1493 /* initial superblock/root creation */ 1503 /* initial superblock/root creation */
1494 s->s_flags = flags;
1495 nfs_clone_super(s, data->sb); 1504 nfs_clone_super(s, data->sb);
1496 } 1505 }
1497 1506
@@ -1668,7 +1677,7 @@ static int nfs4_validate_mount_data(struct nfs4_mount_data **options,
1668 /* while calculating len, pretend ':' is '\0' */ 1677 /* while calculating len, pretend ':' is '\0' */
1669 len = c - dev_name; 1678 len = c - dev_name;
1670 if (len > NFS4_MAXNAMLEN) 1679 if (len > NFS4_MAXNAMLEN)
1671 return -EINVAL; 1680 return -ENAMETOOLONG;
1672 *hostname = kzalloc(len, GFP_KERNEL); 1681 *hostname = kzalloc(len, GFP_KERNEL);
1673 if (*hostname == NULL) 1682 if (*hostname == NULL)
1674 return -ENOMEM; 1683 return -ENOMEM;
@@ -1677,7 +1686,7 @@ static int nfs4_validate_mount_data(struct nfs4_mount_data **options,
1677 c++; /* step over the ':' */ 1686 c++; /* step over the ':' */
1678 len = strlen(c); 1687 len = strlen(c);
1679 if (len > NFS4_MAXPATHLEN) 1688 if (len > NFS4_MAXPATHLEN)
1680 return -EINVAL; 1689 return -ENAMETOOLONG;
1681 *mntpath = kzalloc(len + 1, GFP_KERNEL); 1690 *mntpath = kzalloc(len + 1, GFP_KERNEL);
1682 if (*mntpath == NULL) 1691 if (*mntpath == NULL)
1683 return -ENOMEM; 1692 return -ENOMEM;
@@ -1729,6 +1738,9 @@ static int nfs4_get_sb(struct file_system_type *fs_type,
1729 struct dentry *mntroot; 1738 struct dentry *mntroot;
1730 char *mntpath = NULL, *hostname = NULL, *ip_addr = NULL; 1739 char *mntpath = NULL, *hostname = NULL, *ip_addr = NULL;
1731 int (*compare_super)(struct super_block *, void *) = nfs_compare_super; 1740 int (*compare_super)(struct super_block *, void *) = nfs_compare_super;
1741 struct nfs_sb_mountdata sb_mntdata = {
1742 .mntflags = flags,
1743 };
1732 int error; 1744 int error;
1733 1745
1734 /* Validate the mount data */ 1746 /* Validate the mount data */
@@ -1744,12 +1756,13 @@ static int nfs4_get_sb(struct file_system_type *fs_type,
1744 error = PTR_ERR(server); 1756 error = PTR_ERR(server);
1745 goto out; 1757 goto out;
1746 } 1758 }
1759 sb_mntdata.server = server;
1747 1760
1748 if (server->flags & NFS4_MOUNT_UNSHARED) 1761 if (server->flags & NFS4_MOUNT_UNSHARED)
1749 compare_super = NULL; 1762 compare_super = NULL;
1750 1763
1751 /* Get a superblock - note that we may end up sharing one that already exists */ 1764 /* Get a superblock - note that we may end up sharing one that already exists */
1752 s = sget(fs_type, compare_super, nfs_set_super, server); 1765 s = sget(fs_type, compare_super, nfs_set_super, &sb_mntdata);
1753 if (IS_ERR(s)) { 1766 if (IS_ERR(s)) {
1754 error = PTR_ERR(s); 1767 error = PTR_ERR(s);
1755 goto out_free; 1768 goto out_free;
@@ -1762,7 +1775,6 @@ static int nfs4_get_sb(struct file_system_type *fs_type,
1762 1775
1763 if (!s->s_root) { 1776 if (!s->s_root) {
1764 /* initial superblock/root creation */ 1777 /* initial superblock/root creation */
1765 s->s_flags = flags;
1766 nfs4_fill_super(s); 1778 nfs4_fill_super(s);
1767 } 1779 }
1768 1780
@@ -1816,6 +1828,9 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags,
1816 struct nfs_server *server; 1828 struct nfs_server *server;
1817 struct dentry *mntroot; 1829 struct dentry *mntroot;
1818 int (*compare_super)(struct super_block *, void *) = nfs_compare_super; 1830 int (*compare_super)(struct super_block *, void *) = nfs_compare_super;
1831 struct nfs_sb_mountdata sb_mntdata = {
1832 .mntflags = flags,
1833 };
1819 int error; 1834 int error;
1820 1835
1821 dprintk("--> nfs4_xdev_get_sb()\n"); 1836 dprintk("--> nfs4_xdev_get_sb()\n");
@@ -1826,12 +1841,13 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags,
1826 error = PTR_ERR(server); 1841 error = PTR_ERR(server);
1827 goto out_err_noserver; 1842 goto out_err_noserver;
1828 } 1843 }
1844 sb_mntdata.server = server;
1829 1845
1830 if (server->flags & NFS4_MOUNT_UNSHARED) 1846 if (server->flags & NFS4_MOUNT_UNSHARED)
1831 compare_super = NULL; 1847 compare_super = NULL;
1832 1848
1833 /* Get a superblock - note that we may end up sharing one that already exists */ 1849 /* Get a superblock - note that we may end up sharing one that already exists */
1834 s = sget(&nfs_fs_type, compare_super, nfs_set_super, server); 1850 s = sget(&nfs_fs_type, compare_super, nfs_set_super, &sb_mntdata);
1835 if (IS_ERR(s)) { 1851 if (IS_ERR(s)) {
1836 error = PTR_ERR(s); 1852 error = PTR_ERR(s);
1837 goto out_err_nosb; 1853 goto out_err_nosb;
@@ -1844,7 +1860,6 @@ static int nfs4_xdev_get_sb(struct file_system_type *fs_type, int flags,
1844 1860
1845 if (!s->s_root) { 1861 if (!s->s_root) {
1846 /* initial superblock/root creation */ 1862 /* initial superblock/root creation */
1847 s->s_flags = flags;
1848 nfs4_clone_super(s, data->sb); 1863 nfs4_clone_super(s, data->sb);
1849 } 1864 }
1850 1865
@@ -1887,6 +1902,9 @@ static int nfs4_referral_get_sb(struct file_system_type *fs_type, int flags,
1887 struct dentry *mntroot; 1902 struct dentry *mntroot;
1888 struct nfs_fh mntfh; 1903 struct nfs_fh mntfh;
1889 int (*compare_super)(struct super_block *, void *) = nfs_compare_super; 1904 int (*compare_super)(struct super_block *, void *) = nfs_compare_super;
1905 struct nfs_sb_mountdata sb_mntdata = {
1906 .mntflags = flags,
1907 };
1890 int error; 1908 int error;
1891 1909
1892 dprintk("--> nfs4_referral_get_sb()\n"); 1910 dprintk("--> nfs4_referral_get_sb()\n");
@@ -1897,12 +1915,13 @@ static int nfs4_referral_get_sb(struct file_system_type *fs_type, int flags,
1897 error = PTR_ERR(server); 1915 error = PTR_ERR(server);
1898 goto out_err_noserver; 1916 goto out_err_noserver;
1899 } 1917 }
1918 sb_mntdata.server = server;
1900 1919
1901 if (server->flags & NFS4_MOUNT_UNSHARED) 1920 if (server->flags & NFS4_MOUNT_UNSHARED)
1902 compare_super = NULL; 1921 compare_super = NULL;
1903 1922
1904 /* Get a superblock - note that we may end up sharing one that already exists */ 1923 /* Get a superblock - note that we may end up sharing one that already exists */
1905 s = sget(&nfs_fs_type, compare_super, nfs_set_super, server); 1924 s = sget(&nfs_fs_type, compare_super, nfs_set_super, &sb_mntdata);
1906 if (IS_ERR(s)) { 1925 if (IS_ERR(s)) {
1907 error = PTR_ERR(s); 1926 error = PTR_ERR(s);
1908 goto out_err_nosb; 1927 goto out_err_nosb;
@@ -1915,7 +1934,6 @@ static int nfs4_referral_get_sb(struct file_system_type *fs_type, int flags,
1915 1934
1916 if (!s->s_root) { 1935 if (!s->s_root) {
1917 /* initial superblock/root creation */ 1936 /* initial superblock/root creation */
1918 s->s_flags = flags;
1919 nfs4_fill_super(s); 1937 nfs4_fill_super(s);
1920 } 1938 }
1921 1939
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index ef97e0c0f5..0d7a77cc39 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -1396,6 +1396,50 @@ out:
1396 return ret; 1396 return ret;
1397} 1397}
1398 1398
1399int nfs_wb_page_cancel(struct inode *inode, struct page *page)
1400{
1401 struct nfs_page *req;
1402 loff_t range_start = page_offset(page);
1403 loff_t range_end = range_start + (loff_t)(PAGE_CACHE_SIZE - 1);
1404 struct writeback_control wbc = {
1405 .bdi = page->mapping->backing_dev_info,
1406 .sync_mode = WB_SYNC_ALL,
1407 .nr_to_write = LONG_MAX,
1408 .range_start = range_start,
1409 .range_end = range_end,
1410 };
1411 int ret = 0;
1412
1413 BUG_ON(!PageLocked(page));
1414 for (;;) {
1415 req = nfs_page_find_request(page);
1416 if (req == NULL)
1417 goto out;
1418 if (test_bit(PG_NEED_COMMIT, &req->wb_flags)) {
1419 nfs_release_request(req);
1420 break;
1421 }
1422 if (nfs_lock_request_dontget(req)) {
1423 nfs_inode_remove_request(req);
1424 /*
1425 * In case nfs_inode_remove_request has marked the
1426 * page as being dirty
1427 */
1428 cancel_dirty_page(page, PAGE_CACHE_SIZE);
1429 nfs_unlock_request(req);
1430 break;
1431 }
1432 ret = nfs_wait_on_request(req);
1433 if (ret < 0)
1434 goto out;
1435 }
1436 if (!PagePrivate(page))
1437 return 0;
1438 ret = nfs_sync_mapping_wait(page->mapping, &wbc, FLUSH_INVALIDATE);
1439out:
1440 return ret;
1441}
1442
1399int nfs_wb_page_priority(struct inode *inode, struct page *page, int how) 1443int nfs_wb_page_priority(struct inode *inode, struct page *page, int how)
1400{ 1444{
1401 loff_t range_start = page_offset(page); 1445 loff_t range_start = page_offset(page);
diff --git a/fs/udf/balloc.c b/fs/udf/balloc.c
index 276f7207a5..87e87dcd3f 100644
--- a/fs/udf/balloc.c
+++ b/fs/udf/balloc.c
@@ -540,26 +540,24 @@ static void udf_table_free_blocks(struct super_block *sb,
540 if (epos.offset + adsize > sb->s_blocksize) { 540 if (epos.offset + adsize > sb->s_blocksize) {
541 loffset = epos.offset; 541 loffset = epos.offset;
542 aed->lengthAllocDescs = cpu_to_le32(adsize); 542 aed->lengthAllocDescs = cpu_to_le32(adsize);
543 sptr = UDF_I_DATA(inode) + epos.offset - 543 sptr = UDF_I_DATA(table) + epos.offset - adsize;
544 udf_file_entry_alloc_offset(inode) +
545 UDF_I_LENEATTR(inode) - adsize;
546 dptr = epos.bh->b_data + sizeof(struct allocExtDesc); 544 dptr = epos.bh->b_data + sizeof(struct allocExtDesc);
547 memcpy(dptr, sptr, adsize); 545 memcpy(dptr, sptr, adsize);
548 epos.offset = sizeof(struct allocExtDesc) + adsize; 546 epos.offset = sizeof(struct allocExtDesc) + adsize;
549 } else { 547 } else {
550 loffset = epos.offset + adsize; 548 loffset = epos.offset + adsize;
551 aed->lengthAllocDescs = cpu_to_le32(0); 549 aed->lengthAllocDescs = cpu_to_le32(0);
552 sptr = oepos.bh->b_data + epos.offset;
553 epos.offset = sizeof(struct allocExtDesc);
554
555 if (oepos.bh) { 550 if (oepos.bh) {
551 sptr = oepos.bh->b_data + epos.offset;
556 aed = (struct allocExtDesc *)oepos.bh->b_data; 552 aed = (struct allocExtDesc *)oepos.bh->b_data;
557 aed->lengthAllocDescs = 553 aed->lengthAllocDescs =
558 cpu_to_le32(le32_to_cpu(aed->lengthAllocDescs) + adsize); 554 cpu_to_le32(le32_to_cpu(aed->lengthAllocDescs) + adsize);
559 } else { 555 } else {
556 sptr = UDF_I_DATA(table) + epos.offset;
560 UDF_I_LENALLOC(table) += adsize; 557 UDF_I_LENALLOC(table) += adsize;
561 mark_inode_dirty(table); 558 mark_inode_dirty(table);
562 } 559 }
560 epos.offset = sizeof(struct allocExtDesc);
563 } 561 }
564 if (UDF_SB_UDFREV(sb) >= 0x0200) 562 if (UDF_SB_UDFREV(sb) >= 0x0200)
565 udf_new_tag(epos.bh->b_data, TAG_IDENT_AED, 3, 1, 563 udf_new_tag(epos.bh->b_data, TAG_IDENT_AED, 3, 1,
diff --git a/fs/udf/super.c b/fs/udf/super.c
index 382be7be5a..c68a6e730b 100644
--- a/fs/udf/super.c
+++ b/fs/udf/super.c
@@ -89,7 +89,7 @@ static int udf_find_fileset(struct super_block *, kernel_lb_addr *,
89static void udf_load_pvoldesc(struct super_block *, struct buffer_head *); 89static void udf_load_pvoldesc(struct super_block *, struct buffer_head *);
90static void udf_load_fileset(struct super_block *, struct buffer_head *, 90static void udf_load_fileset(struct super_block *, struct buffer_head *,
91 kernel_lb_addr *); 91 kernel_lb_addr *);
92static void udf_load_partdesc(struct super_block *, struct buffer_head *); 92static int udf_load_partdesc(struct super_block *, struct buffer_head *);
93static void udf_open_lvid(struct super_block *); 93static void udf_open_lvid(struct super_block *);
94static void udf_close_lvid(struct super_block *); 94static void udf_close_lvid(struct super_block *);
95static unsigned int udf_count_free(struct super_block *); 95static unsigned int udf_count_free(struct super_block *);
@@ -877,7 +877,7 @@ static void udf_load_fileset(struct super_block *sb, struct buffer_head *bh,
877 root->logicalBlockNum, root->partitionReferenceNum); 877 root->logicalBlockNum, root->partitionReferenceNum);
878} 878}
879 879
880static void udf_load_partdesc(struct super_block *sb, struct buffer_head *bh) 880static int udf_load_partdesc(struct super_block *sb, struct buffer_head *bh)
881{ 881{
882 struct partitionDesc *p; 882 struct partitionDesc *p;
883 int i; 883 int i;
@@ -912,6 +912,11 @@ static void udf_load_partdesc(struct super_block *sb, struct buffer_head *bh)
912 912
913 UDF_SB_PARTMAPS(sb)[i].s_uspace.s_table = 913 UDF_SB_PARTMAPS(sb)[i].s_uspace.s_table =
914 udf_iget(sb, loc); 914 udf_iget(sb, loc);
915 if (!UDF_SB_PARTMAPS(sb)[i].s_uspace.s_table) {
916 udf_debug("cannot load unallocSpaceTable (part %d)\n",
917 i);
918 return 1;
919 }
915 UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_UNALLOC_TABLE; 920 UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_UNALLOC_TABLE;
916 udf_debug("unallocSpaceTable (part %d) @ %ld\n", 921 udf_debug("unallocSpaceTable (part %d) @ %ld\n",
917 i, UDF_SB_PARTMAPS(sb)[i].s_uspace.s_table->i_ino); 922 i, UDF_SB_PARTMAPS(sb)[i].s_uspace.s_table->i_ino);
@@ -938,6 +943,11 @@ static void udf_load_partdesc(struct super_block *sb, struct buffer_head *bh)
938 943
939 UDF_SB_PARTMAPS(sb)[i].s_fspace.s_table = 944 UDF_SB_PARTMAPS(sb)[i].s_fspace.s_table =
940 udf_iget(sb, loc); 945 udf_iget(sb, loc);
946 if (!UDF_SB_PARTMAPS(sb)[i].s_fspace.s_table) {
947 udf_debug("cannot load freedSpaceTable (part %d)\n",
948 i);
949 return 1;
950 }
941 UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_FREED_TABLE; 951 UDF_SB_PARTFLAGS(sb,i) |= UDF_PART_FLAG_FREED_TABLE;
942 udf_debug("freedSpaceTable (part %d) @ %ld\n", 952 udf_debug("freedSpaceTable (part %d) @ %ld\n",
943 i, UDF_SB_PARTMAPS(sb)[i].s_fspace.s_table->i_ino); 953 i, UDF_SB_PARTMAPS(sb)[i].s_fspace.s_table->i_ino);
@@ -966,6 +976,7 @@ static void udf_load_partdesc(struct super_block *sb, struct buffer_head *bh)
966 le16_to_cpu(p->partitionNumber), i, UDF_SB_PARTTYPE(sb,i), 976 le16_to_cpu(p->partitionNumber), i, UDF_SB_PARTTYPE(sb,i),
967 UDF_SB_PARTROOT(sb,i), UDF_SB_PARTLEN(sb,i)); 977 UDF_SB_PARTROOT(sb,i), UDF_SB_PARTLEN(sb,i));
968 } 978 }
979 return 0;
969} 980}
970 981
971static int udf_load_logicalvol(struct super_block *sb, struct buffer_head *bh, 982static int udf_load_logicalvol(struct super_block *sb, struct buffer_head *bh,
@@ -1177,12 +1188,19 @@ static int udf_process_sequence(struct super_block *sb, long block, long lastblo
1177 udf_load_logicalvol(sb, bh, fileset); 1188 udf_load_logicalvol(sb, bh, fileset);
1178 } else if (i == VDS_POS_PARTITION_DESC) { 1189 } else if (i == VDS_POS_PARTITION_DESC) {
1179 struct buffer_head *bh2 = NULL; 1190 struct buffer_head *bh2 = NULL;
1180 udf_load_partdesc(sb, bh); 1191 if (udf_load_partdesc(sb, bh)) {
1192 brelse(bh);
1193 return 1;
1194 }
1181 for (j = vds[i].block + 1; j < vds[VDS_POS_TERMINATING_DESC].block; j++) { 1195 for (j = vds[i].block + 1; j < vds[VDS_POS_TERMINATING_DESC].block; j++) {
1182 bh2 = udf_read_tagged(sb, j, j, &ident); 1196 bh2 = udf_read_tagged(sb, j, j, &ident);
1183 gd = (struct generic_desc *)bh2->b_data; 1197 gd = (struct generic_desc *)bh2->b_data;
1184 if (ident == TAG_IDENT_PD) 1198 if (ident == TAG_IDENT_PD)
1185 udf_load_partdesc(sb, bh2); 1199 if (udf_load_partdesc(sb, bh2)) {
1200 brelse(bh);
1201 brelse(bh2);
1202 return 1;
1203 }
1186 brelse(bh2); 1204 brelse(bh2);
1187 } 1205 }
1188 } 1206 }