diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /fs/ntfs | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'fs/ntfs')
-rw-r--r-- | fs/ntfs/Makefile | 19 | ||||
-rw-r--r-- | fs/ntfs/aops.c | 4 | ||||
-rw-r--r-- | fs/ntfs/attrib.c | 4 | ||||
-rw-r--r-- | fs/ntfs/compress.c | 5 | ||||
-rw-r--r-- | fs/ntfs/file.c | 35 | ||||
-rw-r--r-- | fs/ntfs/inode.c | 17 | ||||
-rw-r--r-- | fs/ntfs/layout.h | 12 | ||||
-rw-r--r-- | fs/ntfs/logfile.c | 2 | ||||
-rw-r--r-- | fs/ntfs/logfile.h | 2 | ||||
-rw-r--r-- | fs/ntfs/mft.c | 19 | ||||
-rw-r--r-- | fs/ntfs/runlist.c | 2 | ||||
-rw-r--r-- | fs/ntfs/super.c | 72 |
12 files changed, 78 insertions, 115 deletions
diff --git a/fs/ntfs/Makefile b/fs/ntfs/Makefile index 58b6be992544..30206b238433 100644 --- a/fs/ntfs/Makefile +++ b/fs/ntfs/Makefile | |||
@@ -2,18 +2,13 @@ | |||
2 | 2 | ||
3 | obj-$(CONFIG_NTFS_FS) += ntfs.o | 3 | obj-$(CONFIG_NTFS_FS) += ntfs.o |
4 | 4 | ||
5 | ntfs-objs := aops.o attrib.o collate.o compress.o debug.o dir.o file.o \ | 5 | ntfs-y := aops.o attrib.o collate.o compress.o debug.o dir.o file.o \ |
6 | index.o inode.o mft.o mst.o namei.o runlist.o super.o sysctl.o \ | 6 | index.o inode.o mft.o mst.o namei.o runlist.o super.o sysctl.o \ |
7 | unistr.o upcase.o | 7 | unistr.o upcase.o |
8 | 8 | ||
9 | EXTRA_CFLAGS = -DNTFS_VERSION=\"2.1.29\" | 9 | ntfs-$(CONFIG_NTFS_RW) += bitmap.o lcnalloc.o logfile.o quota.o usnjrnl.o |
10 | 10 | ||
11 | ifeq ($(CONFIG_NTFS_DEBUG),y) | 11 | ccflags-y := -DNTFS_VERSION=\"2.1.30\" |
12 | EXTRA_CFLAGS += -DDEBUG | 12 | ccflags-$(CONFIG_NTFS_DEBUG) += -DDEBUG |
13 | endif | 13 | ccflags-$(CONFIG_NTFS_RW) += -DNTFS_RW |
14 | 14 | ||
15 | ifeq ($(CONFIG_NTFS_RW),y) | ||
16 | EXTRA_CFLAGS += -DNTFS_RW | ||
17 | |||
18 | ntfs-objs += bitmap.o lcnalloc.o logfile.o quota.o usnjrnl.o | ||
19 | endif | ||
diff --git a/fs/ntfs/aops.c b/fs/ntfs/aops.c index c3c2c7ac9020..0b1e885b8cf8 100644 --- a/fs/ntfs/aops.c +++ b/fs/ntfs/aops.c | |||
@@ -1543,8 +1543,6 @@ err_out: | |||
1543 | */ | 1543 | */ |
1544 | const struct address_space_operations ntfs_aops = { | 1544 | const struct address_space_operations ntfs_aops = { |
1545 | .readpage = ntfs_readpage, /* Fill page with data. */ | 1545 | .readpage = ntfs_readpage, /* Fill page with data. */ |
1546 | .sync_page = block_sync_page, /* Currently, just unplugs the | ||
1547 | disk request queue. */ | ||
1548 | #ifdef NTFS_RW | 1546 | #ifdef NTFS_RW |
1549 | .writepage = ntfs_writepage, /* Write dirty page to disk. */ | 1547 | .writepage = ntfs_writepage, /* Write dirty page to disk. */ |
1550 | #endif /* NTFS_RW */ | 1548 | #endif /* NTFS_RW */ |
@@ -1560,8 +1558,6 @@ const struct address_space_operations ntfs_aops = { | |||
1560 | */ | 1558 | */ |
1561 | const struct address_space_operations ntfs_mst_aops = { | 1559 | const struct address_space_operations ntfs_mst_aops = { |
1562 | .readpage = ntfs_readpage, /* Fill page with data. */ | 1560 | .readpage = ntfs_readpage, /* Fill page with data. */ |
1563 | .sync_page = block_sync_page, /* Currently, just unplugs the | ||
1564 | disk request queue. */ | ||
1565 | #ifdef NTFS_RW | 1561 | #ifdef NTFS_RW |
1566 | .writepage = ntfs_writepage, /* Write dirty page to disk. */ | 1562 | .writepage = ntfs_writepage, /* Write dirty page to disk. */ |
1567 | .set_page_dirty = __set_page_dirty_nobuffers, /* Set the page dirty | 1563 | .set_page_dirty = __set_page_dirty_nobuffers, /* Set the page dirty |
diff --git a/fs/ntfs/attrib.c b/fs/ntfs/attrib.c index f5094ee224c1..f14fde2b03d6 100644 --- a/fs/ntfs/attrib.c +++ b/fs/ntfs/attrib.c | |||
@@ -197,7 +197,7 @@ err_out: | |||
197 | } else if (ctx_needs_reset) { | 197 | } else if (ctx_needs_reset) { |
198 | /* | 198 | /* |
199 | * If there is no attribute list, restoring the search context | 199 | * If there is no attribute list, restoring the search context |
200 | * is acomplished simply by copying the saved context back over | 200 | * is accomplished simply by copying the saved context back over |
201 | * the caller supplied context. If there is an attribute list, | 201 | * the caller supplied context. If there is an attribute list, |
202 | * things are more complicated as we need to deal with mapping | 202 | * things are more complicated as we need to deal with mapping |
203 | * of mft records and resulting potential changes in pointers. | 203 | * of mft records and resulting potential changes in pointers. |
@@ -1181,7 +1181,7 @@ not_found: | |||
1181 | * for, i.e. if one wants to add the attribute to the mft record this is the | 1181 | * for, i.e. if one wants to add the attribute to the mft record this is the |
1182 | * correct place to insert its attribute list entry into. | 1182 | * correct place to insert its attribute list entry into. |
1183 | * | 1183 | * |
1184 | * When -errno != -ENOENT, an error occured during the lookup. @ctx->attr is | 1184 | * When -errno != -ENOENT, an error occurred during the lookup. @ctx->attr is |
1185 | * then undefined and in particular you should not rely on it not changing. | 1185 | * then undefined and in particular you should not rely on it not changing. |
1186 | */ | 1186 | */ |
1187 | int ntfs_attr_lookup(const ATTR_TYPE type, const ntfschar *name, | 1187 | int ntfs_attr_lookup(const ATTR_TYPE type, const ntfschar *name, |
diff --git a/fs/ntfs/compress.c b/fs/ntfs/compress.c index 6551c7cbad92..ee4144ce5d7c 100644 --- a/fs/ntfs/compress.c +++ b/fs/ntfs/compress.c | |||
@@ -501,7 +501,7 @@ int ntfs_read_compressed_block(struct page *page) | |||
501 | VCN start_vcn = (((s64)index << PAGE_CACHE_SHIFT) & ~cb_size_mask) >> | 501 | VCN start_vcn = (((s64)index << PAGE_CACHE_SHIFT) & ~cb_size_mask) >> |
502 | vol->cluster_size_bits; | 502 | vol->cluster_size_bits; |
503 | /* | 503 | /* |
504 | * The first vcn after the last wanted vcn (minumum alignment is again | 504 | * The first vcn after the last wanted vcn (minimum alignment is again |
505 | * PAGE_CACHE_SIZE. | 505 | * PAGE_CACHE_SIZE. |
506 | */ | 506 | */ |
507 | VCN end_vcn = ((((s64)(index + 1UL) << PAGE_CACHE_SHIFT) + cb_size - 1) | 507 | VCN end_vcn = ((((s64)(index + 1UL) << PAGE_CACHE_SHIFT) + cb_size - 1) |
@@ -698,8 +698,7 @@ lock_retry_remap: | |||
698 | "uptodate! Unplugging the disk queue " | 698 | "uptodate! Unplugging the disk queue " |
699 | "and rescheduling."); | 699 | "and rescheduling."); |
700 | get_bh(tbh); | 700 | get_bh(tbh); |
701 | blk_run_address_space(mapping); | 701 | io_schedule(); |
702 | schedule(); | ||
703 | put_bh(tbh); | 702 | put_bh(tbh); |
704 | if (unlikely(!buffer_uptodate(tbh))) | 703 | if (unlikely(!buffer_uptodate(tbh))) |
705 | goto read_err; | 704 | goto read_err; |
diff --git a/fs/ntfs/file.c b/fs/ntfs/file.c index 113ebd9f25a4..f4b1057abdd2 100644 --- a/fs/ntfs/file.c +++ b/fs/ntfs/file.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * file.c - NTFS kernel file operations. Part of the Linux-NTFS project. | 2 | * file.c - NTFS kernel file operations. Part of the Linux-NTFS project. |
3 | * | 3 | * |
4 | * Copyright (c) 2001-2007 Anton Altaparmakov | 4 | * Copyright (c) 2001-2011 Anton Altaparmakov and Tuxera Inc. |
5 | * | 5 | * |
6 | * This program/include file is free software; you can redistribute it and/or | 6 | * This program/include file is free software; you can redistribute it and/or |
7 | * modify it under the terms of the GNU General Public License as published | 7 | * modify it under the terms of the GNU General Public License as published |
@@ -1380,15 +1380,14 @@ static inline void ntfs_set_next_iovec(const struct iovec **iovp, | |||
1380 | * pages (out to offset + bytes), to emulate ntfs_copy_from_user()'s | 1380 | * pages (out to offset + bytes), to emulate ntfs_copy_from_user()'s |
1381 | * single-segment behaviour. | 1381 | * single-segment behaviour. |
1382 | * | 1382 | * |
1383 | * We call the same helper (__ntfs_copy_from_user_iovec_inatomic()) both | 1383 | * We call the same helper (__ntfs_copy_from_user_iovec_inatomic()) both when |
1384 | * when atomic and when not atomic. This is ok because | 1384 | * atomic and when not atomic. This is ok because it calls |
1385 | * __ntfs_copy_from_user_iovec_inatomic() calls __copy_from_user_inatomic() | 1385 | * __copy_from_user_inatomic() and it is ok to call this when non-atomic. In |
1386 | * and it is ok to call this when non-atomic. | 1386 | * fact, the only difference between __copy_from_user_inatomic() and |
1387 | * Infact, the only difference between __copy_from_user_inatomic() and | ||
1388 | * __copy_from_user() is that the latter calls might_sleep() and the former | 1387 | * __copy_from_user() is that the latter calls might_sleep() and the former |
1389 | * should not zero the tail of the buffer on error. And on many | 1388 | * should not zero the tail of the buffer on error. And on many architectures |
1390 | * architectures __copy_from_user_inatomic() is just defined to | 1389 | * __copy_from_user_inatomic() is just defined to __copy_from_user() so it |
1391 | * __copy_from_user() so it makes no difference at all on those architectures. | 1390 | * makes no difference at all on those architectures. |
1392 | */ | 1391 | */ |
1393 | static inline size_t ntfs_copy_from_user_iovec(struct page **pages, | 1392 | static inline size_t ntfs_copy_from_user_iovec(struct page **pages, |
1394 | unsigned nr_pages, unsigned ofs, const struct iovec **iov, | 1393 | unsigned nr_pages, unsigned ofs, const struct iovec **iov, |
@@ -1409,28 +1408,28 @@ static inline size_t ntfs_copy_from_user_iovec(struct page **pages, | |||
1409 | if (unlikely(copied != len)) { | 1408 | if (unlikely(copied != len)) { |
1410 | /* Do it the slow way. */ | 1409 | /* Do it the slow way. */ |
1411 | addr = kmap(*pages); | 1410 | addr = kmap(*pages); |
1412 | copied = __ntfs_copy_from_user_iovec_inatomic(addr + ofs, | 1411 | copied = __ntfs_copy_from_user_iovec_inatomic(addr + |
1413 | *iov, *iov_ofs, len); | 1412 | ofs, *iov, *iov_ofs, len); |
1414 | /* | ||
1415 | * Zero the rest of the target like __copy_from_user(). | ||
1416 | */ | ||
1417 | memset(addr + ofs + copied, 0, len - copied); | ||
1418 | kunmap(*pages); | ||
1419 | if (unlikely(copied != len)) | 1413 | if (unlikely(copied != len)) |
1420 | goto err_out; | 1414 | goto err_out; |
1415 | kunmap(*pages); | ||
1421 | } | 1416 | } |
1422 | total += len; | 1417 | total += len; |
1418 | ntfs_set_next_iovec(iov, iov_ofs, len); | ||
1423 | bytes -= len; | 1419 | bytes -= len; |
1424 | if (!bytes) | 1420 | if (!bytes) |
1425 | break; | 1421 | break; |
1426 | ntfs_set_next_iovec(iov, iov_ofs, len); | ||
1427 | ofs = 0; | 1422 | ofs = 0; |
1428 | } while (++pages < last_page); | 1423 | } while (++pages < last_page); |
1429 | out: | 1424 | out: |
1430 | return total; | 1425 | return total; |
1431 | err_out: | 1426 | err_out: |
1432 | total += copied; | 1427 | BUG_ON(copied > len); |
1433 | /* Zero the rest of the target like __copy_from_user(). */ | 1428 | /* Zero the rest of the target like __copy_from_user(). */ |
1429 | memset(addr + ofs + copied, 0, len - copied); | ||
1430 | kunmap(*pages); | ||
1431 | total += copied; | ||
1432 | ntfs_set_next_iovec(iov, iov_ofs, copied); | ||
1434 | while (++pages < last_page) { | 1433 | while (++pages < last_page) { |
1435 | bytes -= len; | 1434 | bytes -= len; |
1436 | if (!bytes) | 1435 | if (!bytes) |
diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c index 93622b175fc7..c05d6dcf77a4 100644 --- a/fs/ntfs/inode.c +++ b/fs/ntfs/inode.c | |||
@@ -54,7 +54,7 @@ | |||
54 | * | 54 | * |
55 | * Return 1 if the attributes match and 0 if not. | 55 | * Return 1 if the attributes match and 0 if not. |
56 | * | 56 | * |
57 | * NOTE: This function runs with the inode_lock spin lock held so it is not | 57 | * NOTE: This function runs with the inode->i_lock spin lock held so it is not |
58 | * allowed to sleep. | 58 | * allowed to sleep. |
59 | */ | 59 | */ |
60 | int ntfs_test_inode(struct inode *vi, ntfs_attr *na) | 60 | int ntfs_test_inode(struct inode *vi, ntfs_attr *na) |
@@ -98,7 +98,7 @@ int ntfs_test_inode(struct inode *vi, ntfs_attr *na) | |||
98 | * | 98 | * |
99 | * Return 0 on success and -errno on error. | 99 | * Return 0 on success and -errno on error. |
100 | * | 100 | * |
101 | * NOTE: This function runs with the inode_lock spin lock held so it is not | 101 | * NOTE: This function runs with the inode->i_lock spin lock held so it is not |
102 | * allowed to sleep. (Hence the GFP_ATOMIC allocation.) | 102 | * allowed to sleep. (Hence the GFP_ATOMIC allocation.) |
103 | */ | 103 | */ |
104 | static int ntfs_init_locked_inode(struct inode *vi, ntfs_attr *na) | 104 | static int ntfs_init_locked_inode(struct inode *vi, ntfs_attr *na) |
@@ -332,6 +332,13 @@ struct inode *ntfs_alloc_big_inode(struct super_block *sb) | |||
332 | return NULL; | 332 | return NULL; |
333 | } | 333 | } |
334 | 334 | ||
335 | static void ntfs_i_callback(struct rcu_head *head) | ||
336 | { | ||
337 | struct inode *inode = container_of(head, struct inode, i_rcu); | ||
338 | INIT_LIST_HEAD(&inode->i_dentry); | ||
339 | kmem_cache_free(ntfs_big_inode_cache, NTFS_I(inode)); | ||
340 | } | ||
341 | |||
335 | void ntfs_destroy_big_inode(struct inode *inode) | 342 | void ntfs_destroy_big_inode(struct inode *inode) |
336 | { | 343 | { |
337 | ntfs_inode *ni = NTFS_I(inode); | 344 | ntfs_inode *ni = NTFS_I(inode); |
@@ -340,7 +347,7 @@ void ntfs_destroy_big_inode(struct inode *inode) | |||
340 | BUG_ON(ni->page); | 347 | BUG_ON(ni->page); |
341 | if (!atomic_dec_and_test(&ni->count)) | 348 | if (!atomic_dec_and_test(&ni->count)) |
342 | BUG(); | 349 | BUG(); |
343 | kmem_cache_free(ntfs_big_inode_cache, NTFS_I(inode)); | 350 | call_rcu(&inode->i_rcu, ntfs_i_callback); |
344 | } | 351 | } |
345 | 352 | ||
346 | static inline ntfs_inode *ntfs_alloc_extent_inode(void) | 353 | static inline ntfs_inode *ntfs_alloc_extent_inode(void) |
@@ -615,7 +622,7 @@ static int ntfs_read_locked_inode(struct inode *vi) | |||
615 | */ | 622 | */ |
616 | /* Everyone gets all permissions. */ | 623 | /* Everyone gets all permissions. */ |
617 | vi->i_mode |= S_IRWXUGO; | 624 | vi->i_mode |= S_IRWXUGO; |
618 | /* If read-only, noone gets write permissions. */ | 625 | /* If read-only, no one gets write permissions. */ |
619 | if (IS_RDONLY(vi)) | 626 | if (IS_RDONLY(vi)) |
620 | vi->i_mode &= ~S_IWUGO; | 627 | vi->i_mode &= ~S_IWUGO; |
621 | if (m->flags & MFT_RECORD_IS_DIRECTORY) { | 628 | if (m->flags & MFT_RECORD_IS_DIRECTORY) { |
@@ -2522,7 +2529,7 @@ retry_truncate: | |||
2522 | * specifies that the behaviour is unspecified thus we do not | 2529 | * specifies that the behaviour is unspecified thus we do not |
2523 | * have to do anything. This means that in our implementation | 2530 | * have to do anything. This means that in our implementation |
2524 | * in the rare case that the file is mmap()ped and a write | 2531 | * in the rare case that the file is mmap()ped and a write |
2525 | * occured into the mmap()ped region just beyond the file size | 2532 | * occurred into the mmap()ped region just beyond the file size |
2526 | * and writepage has not yet been called to write out the page | 2533 | * and writepage has not yet been called to write out the page |
2527 | * (which would clear the area beyond the file size) and we now | 2534 | * (which would clear the area beyond the file size) and we now |
2528 | * extend the file size to incorporate this dirty region | 2535 | * extend the file size to incorporate this dirty region |
diff --git a/fs/ntfs/layout.h b/fs/ntfs/layout.h index 8b2549f672bf..faece7190866 100644 --- a/fs/ntfs/layout.h +++ b/fs/ntfs/layout.h | |||
@@ -286,7 +286,7 @@ typedef le16 MFT_RECORD_FLAGS; | |||
286 | * fragmented. Volume free space includes the empty part of the mft zone and | 286 | * fragmented. Volume free space includes the empty part of the mft zone and |
287 | * when the volume's free 88% are used up, the mft zone is shrunk by a factor | 287 | * when the volume's free 88% are used up, the mft zone is shrunk by a factor |
288 | * of 2, thus making more space available for more files/data. This process is | 288 | * of 2, thus making more space available for more files/data. This process is |
289 | * repeated everytime there is no more free space except for the mft zone until | 289 | * repeated every time there is no more free space except for the mft zone until |
290 | * there really is no more free space. | 290 | * there really is no more free space. |
291 | */ | 291 | */ |
292 | 292 | ||
@@ -1657,13 +1657,13 @@ typedef enum { | |||
1657 | * pointed to by the Owner field was provided by a defaulting mechanism | 1657 | * pointed to by the Owner field was provided by a defaulting mechanism |
1658 | * rather than explicitly provided by the original provider of the | 1658 | * rather than explicitly provided by the original provider of the |
1659 | * security descriptor. This may affect the treatment of the SID with | 1659 | * security descriptor. This may affect the treatment of the SID with |
1660 | * respect to inheritence of an owner. | 1660 | * respect to inheritance of an owner. |
1661 | * | 1661 | * |
1662 | * SE_GROUP_DEFAULTED - This boolean flag, when set, indicates that the SID in | 1662 | * SE_GROUP_DEFAULTED - This boolean flag, when set, indicates that the SID in |
1663 | * the Group field was provided by a defaulting mechanism rather than | 1663 | * the Group field was provided by a defaulting mechanism rather than |
1664 | * explicitly provided by the original provider of the security | 1664 | * explicitly provided by the original provider of the security |
1665 | * descriptor. This may affect the treatment of the SID with respect to | 1665 | * descriptor. This may affect the treatment of the SID with respect to |
1666 | * inheritence of a primary group. | 1666 | * inheritance of a primary group. |
1667 | * | 1667 | * |
1668 | * SE_DACL_PRESENT - This boolean flag, when set, indicates that the security | 1668 | * SE_DACL_PRESENT - This boolean flag, when set, indicates that the security |
1669 | * descriptor contains a discretionary ACL. If this flag is set and the | 1669 | * descriptor contains a discretionary ACL. If this flag is set and the |
@@ -1674,7 +1674,7 @@ typedef enum { | |||
1674 | * pointed to by the Dacl field was provided by a defaulting mechanism | 1674 | * pointed to by the Dacl field was provided by a defaulting mechanism |
1675 | * rather than explicitly provided by the original provider of the | 1675 | * rather than explicitly provided by the original provider of the |
1676 | * security descriptor. This may affect the treatment of the ACL with | 1676 | * security descriptor. This may affect the treatment of the ACL with |
1677 | * respect to inheritence of an ACL. This flag is ignored if the | 1677 | * respect to inheritance of an ACL. This flag is ignored if the |
1678 | * DaclPresent flag is not set. | 1678 | * DaclPresent flag is not set. |
1679 | * | 1679 | * |
1680 | * SE_SACL_PRESENT - This boolean flag, when set, indicates that the security | 1680 | * SE_SACL_PRESENT - This boolean flag, when set, indicates that the security |
@@ -1686,7 +1686,7 @@ typedef enum { | |||
1686 | * pointed to by the Sacl field was provided by a defaulting mechanism | 1686 | * pointed to by the Sacl field was provided by a defaulting mechanism |
1687 | * rather than explicitly provided by the original provider of the | 1687 | * rather than explicitly provided by the original provider of the |
1688 | * security descriptor. This may affect the treatment of the ACL with | 1688 | * security descriptor. This may affect the treatment of the ACL with |
1689 | * respect to inheritence of an ACL. This flag is ignored if the | 1689 | * respect to inheritance of an ACL. This flag is ignored if the |
1690 | * SaclPresent flag is not set. | 1690 | * SaclPresent flag is not set. |
1691 | * | 1691 | * |
1692 | * SE_SELF_RELATIVE - This boolean flag, when set, indicates that the security | 1692 | * SE_SELF_RELATIVE - This boolean flag, when set, indicates that the security |
@@ -2283,7 +2283,7 @@ typedef struct { | |||
2283 | // the key_length is zero, then the vcn immediately | 2283 | // the key_length is zero, then the vcn immediately |
2284 | // follows the INDEX_ENTRY_HEADER. Regardless of | 2284 | // follows the INDEX_ENTRY_HEADER. Regardless of |
2285 | // key_length, the address of the 8-byte boundary | 2285 | // key_length, the address of the 8-byte boundary |
2286 | // alligned vcn of INDEX_ENTRY{_HEADER} *ie is given by | 2286 | // aligned vcn of INDEX_ENTRY{_HEADER} *ie is given by |
2287 | // (char*)ie + le16_to_cpu(ie*)->length) - sizeof(VCN), | 2287 | // (char*)ie + le16_to_cpu(ie*)->length) - sizeof(VCN), |
2288 | // where sizeof(VCN) can be hardcoded as 8 if wanted. */ | 2288 | // where sizeof(VCN) can be hardcoded as 8 if wanted. */ |
2289 | } __attribute__ ((__packed__)) INDEX_ENTRY; | 2289 | } __attribute__ ((__packed__)) INDEX_ENTRY; |
diff --git a/fs/ntfs/logfile.c b/fs/ntfs/logfile.c index 4dadcdf3d451..c71de292c5ad 100644 --- a/fs/ntfs/logfile.c +++ b/fs/ntfs/logfile.c | |||
@@ -669,7 +669,7 @@ err_out: | |||
669 | * of cases where we think that a volume is dirty when in fact it is clean. | 669 | * of cases where we think that a volume is dirty when in fact it is clean. |
670 | * This should only affect volumes that have not been shutdown cleanly but did | 670 | * This should only affect volumes that have not been shutdown cleanly but did |
671 | * not have any pending, non-check-pointed i/o, i.e. they were completely idle | 671 | * not have any pending, non-check-pointed i/o, i.e. they were completely idle |
672 | * at least for the five seconds preceeding the unclean shutdown. | 672 | * at least for the five seconds preceding the unclean shutdown. |
673 | * | 673 | * |
674 | * This function assumes that the $LogFile journal has already been consistency | 674 | * This function assumes that the $LogFile journal has already been consistency |
675 | * checked by a call to ntfs_check_logfile() and in particular if the $LogFile | 675 | * checked by a call to ntfs_check_logfile() and in particular if the $LogFile |
diff --git a/fs/ntfs/logfile.h b/fs/ntfs/logfile.h index b5a6f08bd35c..aa2b6ac3f0a4 100644 --- a/fs/ntfs/logfile.h +++ b/fs/ntfs/logfile.h | |||
@@ -222,7 +222,7 @@ typedef struct { | |||
222 | /* 24*/ sle64 file_size; /* Usable byte size of the log file. If the | 222 | /* 24*/ sle64 file_size; /* Usable byte size of the log file. If the |
223 | restart_area_offset + the offset of the | 223 | restart_area_offset + the offset of the |
224 | file_size are > 510 then corruption has | 224 | file_size are > 510 then corruption has |
225 | occured. This is the very first check when | 225 | occurred. This is the very first check when |
226 | starting with the restart_area as if it | 226 | starting with the restart_area as if it |
227 | fails it means that some of the above values | 227 | fails it means that some of the above values |
228 | will be corrupted by the multi sector | 228 | will be corrupted by the multi sector |
diff --git a/fs/ntfs/mft.c b/fs/ntfs/mft.c index b572b6727181..382857f9c7db 100644 --- a/fs/ntfs/mft.c +++ b/fs/ntfs/mft.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /** | 1 | /** |
2 | * mft.c - NTFS kernel mft record operations. Part of the Linux-NTFS project. | 2 | * mft.c - NTFS kernel mft record operations. Part of the Linux-NTFS project. |
3 | * | 3 | * |
4 | * Copyright (c) 2001-2006 Anton Altaparmakov | 4 | * Copyright (c) 2001-2011 Anton Altaparmakov and Tuxera Inc. |
5 | * Copyright (c) 2002 Richard Russon | 5 | * Copyright (c) 2002 Richard Russon |
6 | * | 6 | * |
7 | * This program/include file is free software; you can redistribute it and/or | 7 | * This program/include file is free software; you can redistribute it and/or |
@@ -73,7 +73,7 @@ static inline MFT_RECORD *map_mft_record_page(ntfs_inode *ni) | |||
73 | if (index > end_index || (i_size & ~PAGE_CACHE_MASK) < ofs + | 73 | if (index > end_index || (i_size & ~PAGE_CACHE_MASK) < ofs + |
74 | vol->mft_record_size) { | 74 | vol->mft_record_size) { |
75 | page = ERR_PTR(-ENOENT); | 75 | page = ERR_PTR(-ENOENT); |
76 | ntfs_error(vol->sb, "Attemt to read mft record 0x%lx, " | 76 | ntfs_error(vol->sb, "Attempt to read mft record 0x%lx, " |
77 | "which is beyond the end of the mft. " | 77 | "which is beyond the end of the mft. " |
78 | "This is probably a bug in the ntfs " | 78 | "This is probably a bug in the ntfs " |
79 | "driver.", ni->mft_no); | 79 | "driver.", ni->mft_no); |
@@ -1442,7 +1442,7 @@ static int ntfs_mft_bitmap_extend_allocation_nolock(ntfs_volume *vol) | |||
1442 | // Note: It will need to be a special mft record and if none of | 1442 | // Note: It will need to be a special mft record and if none of |
1443 | // those are available it gets rather complicated... | 1443 | // those are available it gets rather complicated... |
1444 | ntfs_error(vol->sb, "Not enough space in this mft record to " | 1444 | ntfs_error(vol->sb, "Not enough space in this mft record to " |
1445 | "accomodate extended mft bitmap attribute " | 1445 | "accommodate extended mft bitmap attribute " |
1446 | "extent. Cannot handle this yet."); | 1446 | "extent. Cannot handle this yet."); |
1447 | ret = -EOPNOTSUPP; | 1447 | ret = -EOPNOTSUPP; |
1448 | goto undo_alloc; | 1448 | goto undo_alloc; |
@@ -1879,7 +1879,7 @@ static int ntfs_mft_data_extend_allocation_nolock(ntfs_volume *vol) | |||
1879 | // and we would then need to update all references to this mft | 1879 | // and we would then need to update all references to this mft |
1880 | // record appropriately. This is rather complicated... | 1880 | // record appropriately. This is rather complicated... |
1881 | ntfs_error(vol->sb, "Not enough space in this mft record to " | 1881 | ntfs_error(vol->sb, "Not enough space in this mft record to " |
1882 | "accomodate extended mft data attribute " | 1882 | "accommodate extended mft data attribute " |
1883 | "extent. Cannot handle this yet."); | 1883 | "extent. Cannot handle this yet."); |
1884 | ret = -EOPNOTSUPP; | 1884 | ret = -EOPNOTSUPP; |
1885 | goto undo_alloc; | 1885 | goto undo_alloc; |
@@ -2357,7 +2357,7 @@ ntfs_inode *ntfs_mft_record_alloc(ntfs_volume *vol, const int mode, | |||
2357 | } | 2357 | } |
2358 | #ifdef DEBUG | 2358 | #ifdef DEBUG |
2359 | read_lock_irqsave(&mftbmp_ni->size_lock, flags); | 2359 | read_lock_irqsave(&mftbmp_ni->size_lock, flags); |
2360 | ntfs_debug("Status of mftbmp after initialized extention: " | 2360 | ntfs_debug("Status of mftbmp after initialized extension: " |
2361 | "allocated_size 0x%llx, data_size 0x%llx, " | 2361 | "allocated_size 0x%llx, data_size 0x%llx, " |
2362 | "initialized_size 0x%llx.", | 2362 | "initialized_size 0x%llx.", |
2363 | (long long)mftbmp_ni->allocated_size, | 2363 | (long long)mftbmp_ni->allocated_size, |
@@ -2576,6 +2576,8 @@ mft_rec_already_initialized: | |||
2576 | flush_dcache_page(page); | 2576 | flush_dcache_page(page); |
2577 | SetPageUptodate(page); | 2577 | SetPageUptodate(page); |
2578 | if (base_ni) { | 2578 | if (base_ni) { |
2579 | MFT_RECORD *m_tmp; | ||
2580 | |||
2579 | /* | 2581 | /* |
2580 | * Setup the base mft record in the extent mft record. This | 2582 | * Setup the base mft record in the extent mft record. This |
2581 | * completes initialization of the allocated extent mft record | 2583 | * completes initialization of the allocated extent mft record |
@@ -2588,11 +2590,11 @@ mft_rec_already_initialized: | |||
2588 | * attach it to the base inode @base_ni and map, pin, and lock | 2590 | * attach it to the base inode @base_ni and map, pin, and lock |
2589 | * its, i.e. the allocated, mft record. | 2591 | * its, i.e. the allocated, mft record. |
2590 | */ | 2592 | */ |
2591 | m = map_extent_mft_record(base_ni, bit, &ni); | 2593 | m_tmp = map_extent_mft_record(base_ni, bit, &ni); |
2592 | if (IS_ERR(m)) { | 2594 | if (IS_ERR(m_tmp)) { |
2593 | ntfs_error(vol->sb, "Failed to map allocated extent " | 2595 | ntfs_error(vol->sb, "Failed to map allocated extent " |
2594 | "mft record 0x%llx.", (long long)bit); | 2596 | "mft record 0x%llx.", (long long)bit); |
2595 | err = PTR_ERR(m); | 2597 | err = PTR_ERR(m_tmp); |
2596 | /* Set the mft record itself not in use. */ | 2598 | /* Set the mft record itself not in use. */ |
2597 | m->flags &= cpu_to_le16( | 2599 | m->flags &= cpu_to_le16( |
2598 | ~le16_to_cpu(MFT_RECORD_IN_USE)); | 2600 | ~le16_to_cpu(MFT_RECORD_IN_USE)); |
@@ -2603,6 +2605,7 @@ mft_rec_already_initialized: | |||
2603 | ntfs_unmap_page(page); | 2605 | ntfs_unmap_page(page); |
2604 | goto undo_mftbmp_alloc; | 2606 | goto undo_mftbmp_alloc; |
2605 | } | 2607 | } |
2608 | BUG_ON(m != m_tmp); | ||
2606 | /* | 2609 | /* |
2607 | * Make sure the allocated mft record is written out to disk. | 2610 | * Make sure the allocated mft record is written out to disk. |
2608 | * No need to set the inode dirty because the caller is going | 2611 | * No need to set the inode dirty because the caller is going |
diff --git a/fs/ntfs/runlist.c b/fs/ntfs/runlist.c index 56a9a6d25a2a..eac7d6788a10 100644 --- a/fs/ntfs/runlist.c +++ b/fs/ntfs/runlist.c | |||
@@ -1243,7 +1243,7 @@ err_out: | |||
1243 | * write. | 1243 | * write. |
1244 | * | 1244 | * |
1245 | * This is used when building the mapping pairs array of a runlist to compress | 1245 | * This is used when building the mapping pairs array of a runlist to compress |
1246 | * a given logical cluster number (lcn) or a specific run length to the minumum | 1246 | * a given logical cluster number (lcn) or a specific run length to the minimum |
1247 | * size possible. | 1247 | * size possible. |
1248 | * | 1248 | * |
1249 | * Return the number of bytes written on success. On error, i.e. the | 1249 | * Return the number of bytes written on success. On error, i.e. the |
diff --git a/fs/ntfs/super.c b/fs/ntfs/super.c index 512806171bfa..b52706da4645 100644 --- a/fs/ntfs/super.c +++ b/fs/ntfs/super.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * super.c - NTFS kernel super block handling. Part of the Linux-NTFS project. | 2 | * super.c - NTFS kernel super block handling. Part of the Linux-NTFS project. |
3 | * | 3 | * |
4 | * Copyright (c) 2001-2007 Anton Altaparmakov | 4 | * Copyright (c) 2001-2011 Anton Altaparmakov and Tuxera Inc. |
5 | * Copyright (c) 2001,2002 Richard Russon | 5 | * Copyright (c) 2001,2002 Richard Russon |
6 | * | 6 | * |
7 | * This program/include file is free software; you can redistribute it and/or | 7 | * This program/include file is free software; you can redistribute it and/or |
@@ -30,7 +30,6 @@ | |||
30 | #include <linux/buffer_head.h> | 30 | #include <linux/buffer_head.h> |
31 | #include <linux/vfs.h> | 31 | #include <linux/vfs.h> |
32 | #include <linux/moduleparam.h> | 32 | #include <linux/moduleparam.h> |
33 | #include <linux/smp_lock.h> | ||
34 | #include <linux/bitmap.h> | 33 | #include <linux/bitmap.h> |
35 | 34 | ||
36 | #include "sysctl.h" | 35 | #include "sysctl.h" |
@@ -445,7 +444,6 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt) | |||
445 | 444 | ||
446 | ntfs_debug("Entering with remount options string: %s", opt); | 445 | ntfs_debug("Entering with remount options string: %s", opt); |
447 | 446 | ||
448 | lock_kernel(); | ||
449 | #ifndef NTFS_RW | 447 | #ifndef NTFS_RW |
450 | /* For read-only compiled driver, enforce read-only flag. */ | 448 | /* For read-only compiled driver, enforce read-only flag. */ |
451 | *flags |= MS_RDONLY; | 449 | *flags |= MS_RDONLY; |
@@ -460,7 +458,7 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt) | |||
460 | * the volume on boot and updates them. | 458 | * the volume on boot and updates them. |
461 | * | 459 | * |
462 | * When remounting read-only, mark the volume clean if no volume errors | 460 | * When remounting read-only, mark the volume clean if no volume errors |
463 | * have occured. | 461 | * have occurred. |
464 | */ | 462 | */ |
465 | if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) { | 463 | if ((sb->s_flags & MS_RDONLY) && !(*flags & MS_RDONLY)) { |
466 | static const char *es = ". Cannot remount read-write."; | 464 | static const char *es = ". Cannot remount read-write."; |
@@ -469,18 +467,15 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt) | |||
469 | if (NVolErrors(vol)) { | 467 | if (NVolErrors(vol)) { |
470 | ntfs_error(sb, "Volume has errors and is read-only%s", | 468 | ntfs_error(sb, "Volume has errors and is read-only%s", |
471 | es); | 469 | es); |
472 | unlock_kernel(); | ||
473 | return -EROFS; | 470 | return -EROFS; |
474 | } | 471 | } |
475 | if (vol->vol_flags & VOLUME_IS_DIRTY) { | 472 | if (vol->vol_flags & VOLUME_IS_DIRTY) { |
476 | ntfs_error(sb, "Volume is dirty and read-only%s", es); | 473 | ntfs_error(sb, "Volume is dirty and read-only%s", es); |
477 | unlock_kernel(); | ||
478 | return -EROFS; | 474 | return -EROFS; |
479 | } | 475 | } |
480 | if (vol->vol_flags & VOLUME_MODIFIED_BY_CHKDSK) { | 476 | if (vol->vol_flags & VOLUME_MODIFIED_BY_CHKDSK) { |
481 | ntfs_error(sb, "Volume has been modified by chkdsk " | 477 | ntfs_error(sb, "Volume has been modified by chkdsk " |
482 | "and is read-only%s", es); | 478 | "and is read-only%s", es); |
483 | unlock_kernel(); | ||
484 | return -EROFS; | 479 | return -EROFS; |
485 | } | 480 | } |
486 | if (vol->vol_flags & VOLUME_MUST_MOUNT_RO_MASK) { | 481 | if (vol->vol_flags & VOLUME_MUST_MOUNT_RO_MASK) { |
@@ -488,13 +483,11 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt) | |||
488 | "(0x%x) and is read-only%s", | 483 | "(0x%x) and is read-only%s", |
489 | (unsigned)le16_to_cpu(vol->vol_flags), | 484 | (unsigned)le16_to_cpu(vol->vol_flags), |
490 | es); | 485 | es); |
491 | unlock_kernel(); | ||
492 | return -EROFS; | 486 | return -EROFS; |
493 | } | 487 | } |
494 | if (ntfs_set_volume_flags(vol, VOLUME_IS_DIRTY)) { | 488 | if (ntfs_set_volume_flags(vol, VOLUME_IS_DIRTY)) { |
495 | ntfs_error(sb, "Failed to set dirty bit in volume " | 489 | ntfs_error(sb, "Failed to set dirty bit in volume " |
496 | "information flags%s", es); | 490 | "information flags%s", es); |
497 | unlock_kernel(); | ||
498 | return -EROFS; | 491 | return -EROFS; |
499 | } | 492 | } |
500 | #if 0 | 493 | #if 0 |
@@ -514,21 +507,18 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt) | |||
514 | ntfs_error(sb, "Failed to empty journal $LogFile%s", | 507 | ntfs_error(sb, "Failed to empty journal $LogFile%s", |
515 | es); | 508 | es); |
516 | NVolSetErrors(vol); | 509 | NVolSetErrors(vol); |
517 | unlock_kernel(); | ||
518 | return -EROFS; | 510 | return -EROFS; |
519 | } | 511 | } |
520 | if (!ntfs_mark_quotas_out_of_date(vol)) { | 512 | if (!ntfs_mark_quotas_out_of_date(vol)) { |
521 | ntfs_error(sb, "Failed to mark quotas out of date%s", | 513 | ntfs_error(sb, "Failed to mark quotas out of date%s", |
522 | es); | 514 | es); |
523 | NVolSetErrors(vol); | 515 | NVolSetErrors(vol); |
524 | unlock_kernel(); | ||
525 | return -EROFS; | 516 | return -EROFS; |
526 | } | 517 | } |
527 | if (!ntfs_stamp_usnjrnl(vol)) { | 518 | if (!ntfs_stamp_usnjrnl(vol)) { |
528 | ntfs_error(sb, "Failed to stamp transation log " | 519 | ntfs_error(sb, "Failed to stamp transation log " |
529 | "($UsnJrnl)%s", es); | 520 | "($UsnJrnl)%s", es); |
530 | NVolSetErrors(vol); | 521 | NVolSetErrors(vol); |
531 | unlock_kernel(); | ||
532 | return -EROFS; | 522 | return -EROFS; |
533 | } | 523 | } |
534 | } else if (!(sb->s_flags & MS_RDONLY) && (*flags & MS_RDONLY)) { | 524 | } else if (!(sb->s_flags & MS_RDONLY) && (*flags & MS_RDONLY)) { |
@@ -544,11 +534,9 @@ static int ntfs_remount(struct super_block *sb, int *flags, char *opt) | |||
544 | 534 | ||
545 | // TODO: Deal with *flags. | 535 | // TODO: Deal with *flags. |
546 | 536 | ||
547 | if (!parse_options(vol, opt)) { | 537 | if (!parse_options(vol, opt)) |
548 | unlock_kernel(); | ||
549 | return -EINVAL; | 538 | return -EINVAL; |
550 | } | 539 | |
551 | unlock_kernel(); | ||
552 | ntfs_debug("Done."); | 540 | ntfs_debug("Done."); |
553 | return 0; | 541 | return 0; |
554 | } | 542 | } |
@@ -1281,7 +1269,7 @@ static int check_windows_hibernation_status(ntfs_volume *vol) | |||
1281 | "hibernated on the volume."); | 1269 | "hibernated on the volume."); |
1282 | return 0; | 1270 | return 0; |
1283 | } | 1271 | } |
1284 | /* A real error occured. */ | 1272 | /* A real error occurred. */ |
1285 | ntfs_error(vol->sb, "Failed to find inode number for " | 1273 | ntfs_error(vol->sb, "Failed to find inode number for " |
1286 | "hiberfil.sys."); | 1274 | "hiberfil.sys."); |
1287 | return ret; | 1275 | return ret; |
@@ -1382,7 +1370,7 @@ static bool load_and_init_quota(ntfs_volume *vol) | |||
1382 | NVolSetQuotaOutOfDate(vol); | 1370 | NVolSetQuotaOutOfDate(vol); |
1383 | return true; | 1371 | return true; |
1384 | } | 1372 | } |
1385 | /* A real error occured. */ | 1373 | /* A real error occurred. */ |
1386 | ntfs_error(vol->sb, "Failed to find inode number for $Quota."); | 1374 | ntfs_error(vol->sb, "Failed to find inode number for $Quota."); |
1387 | return false; | 1375 | return false; |
1388 | } | 1376 | } |
@@ -1466,7 +1454,7 @@ not_enabled: | |||
1466 | NVolSetUsnJrnlStamped(vol); | 1454 | NVolSetUsnJrnlStamped(vol); |
1467 | return true; | 1455 | return true; |
1468 | } | 1456 | } |
1469 | /* A real error occured. */ | 1457 | /* A real error occurred. */ |
1470 | ntfs_error(vol->sb, "Failed to find inode number for " | 1458 | ntfs_error(vol->sb, "Failed to find inode number for " |
1471 | "$UsnJrnl."); | 1459 | "$UsnJrnl."); |
1472 | return false; | 1460 | return false; |
@@ -2261,8 +2249,6 @@ static void ntfs_put_super(struct super_block *sb) | |||
2261 | 2249 | ||
2262 | ntfs_debug("Entering."); | 2250 | ntfs_debug("Entering."); |
2263 | 2251 | ||
2264 | lock_kernel(); | ||
2265 | |||
2266 | #ifdef NTFS_RW | 2252 | #ifdef NTFS_RW |
2267 | /* | 2253 | /* |
2268 | * Commit all inodes while they are still open in case some of them | 2254 | * Commit all inodes while they are still open in case some of them |
@@ -2306,7 +2292,7 @@ static void ntfs_put_super(struct super_block *sb) | |||
2306 | ntfs_commit_inode(vol->mft_ino); | 2292 | ntfs_commit_inode(vol->mft_ino); |
2307 | 2293 | ||
2308 | /* | 2294 | /* |
2309 | * If a read-write mount and no volume errors have occured, mark the | 2295 | * If a read-write mount and no volume errors have occurred, mark the |
2310 | * volume clean. Also, re-commit all affected inodes. | 2296 | * volume clean. Also, re-commit all affected inodes. |
2311 | */ | 2297 | */ |
2312 | if (!(sb->s_flags & MS_RDONLY)) { | 2298 | if (!(sb->s_flags & MS_RDONLY)) { |
@@ -2433,8 +2419,6 @@ static void ntfs_put_super(struct super_block *sb) | |||
2433 | 2419 | ||
2434 | sb->s_fs_info = NULL; | 2420 | sb->s_fs_info = NULL; |
2435 | kfree(vol); | 2421 | kfree(vol); |
2436 | |||
2437 | unlock_kernel(); | ||
2438 | } | 2422 | } |
2439 | 2423 | ||
2440 | /** | 2424 | /** |
@@ -2512,7 +2496,7 @@ static s64 get_nr_free_clusters(ntfs_volume *vol) | |||
2512 | if (vol->nr_clusters & 63) | 2496 | if (vol->nr_clusters & 63) |
2513 | nr_free += 64 - (vol->nr_clusters & 63); | 2497 | nr_free += 64 - (vol->nr_clusters & 63); |
2514 | up_read(&vol->lcnbmp_lock); | 2498 | up_read(&vol->lcnbmp_lock); |
2515 | /* If errors occured we may well have gone below zero, fix this. */ | 2499 | /* If errors occurred we may well have gone below zero, fix this. */ |
2516 | if (nr_free < 0) | 2500 | if (nr_free < 0) |
2517 | nr_free = 0; | 2501 | nr_free = 0; |
2518 | ntfs_debug("Exiting."); | 2502 | ntfs_debug("Exiting."); |
@@ -2577,7 +2561,7 @@ static unsigned long __get_nr_free_mft_records(ntfs_volume *vol, | |||
2577 | } | 2561 | } |
2578 | ntfs_debug("Finished reading $MFT/$BITMAP, last index = 0x%lx.", | 2562 | ntfs_debug("Finished reading $MFT/$BITMAP, last index = 0x%lx.", |
2579 | index - 1); | 2563 | index - 1); |
2580 | /* If errors occured we may well have gone below zero, fix this. */ | 2564 | /* If errors occurred we may well have gone below zero, fix this. */ |
2581 | if (nr_free < 0) | 2565 | if (nr_free < 0) |
2582 | nr_free = 0; | 2566 | nr_free = 0; |
2583 | ntfs_debug("Exiting."); | 2567 | ntfs_debug("Exiting."); |
@@ -2772,8 +2756,6 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent) | |||
2772 | init_rwsem(&vol->mftbmp_lock); | 2756 | init_rwsem(&vol->mftbmp_lock); |
2773 | init_rwsem(&vol->lcnbmp_lock); | 2757 | init_rwsem(&vol->lcnbmp_lock); |
2774 | 2758 | ||
2775 | unlock_kernel(); | ||
2776 | |||
2777 | /* By default, enable sparse support. */ | 2759 | /* By default, enable sparse support. */ |
2778 | NVolSetSparseEnabled(vol); | 2760 | NVolSetSparseEnabled(vol); |
2779 | 2761 | ||
@@ -2929,8 +2911,8 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent) | |||
2929 | goto unl_upcase_iput_tmp_ino_err_out_now; | 2911 | goto unl_upcase_iput_tmp_ino_err_out_now; |
2930 | } | 2912 | } |
2931 | if ((sb->s_root = d_alloc_root(vol->root_ino))) { | 2913 | if ((sb->s_root = d_alloc_root(vol->root_ino))) { |
2932 | /* We increment i_count simulating an ntfs_iget(). */ | 2914 | /* We grab a reference, simulating an ntfs_iget(). */ |
2933 | atomic_inc(&vol->root_ino->i_count); | 2915 | ihold(vol->root_ino); |
2934 | ntfs_debug("Exiting, status successful."); | 2916 | ntfs_debug("Exiting, status successful."); |
2935 | /* Release the default upcase if it has no users. */ | 2917 | /* Release the default upcase if it has no users. */ |
2936 | mutex_lock(&ntfs_lock); | 2918 | mutex_lock(&ntfs_lock); |
@@ -2940,7 +2922,6 @@ static int ntfs_fill_super(struct super_block *sb, void *opt, const int silent) | |||
2940 | } | 2922 | } |
2941 | mutex_unlock(&ntfs_lock); | 2923 | mutex_unlock(&ntfs_lock); |
2942 | sb->s_export_op = &ntfs_export_ops; | 2924 | sb->s_export_op = &ntfs_export_ops; |
2943 | lock_kernel(); | ||
2944 | lockdep_on(); | 2925 | lockdep_on(); |
2945 | return 0; | 2926 | return 0; |
2946 | } | 2927 | } |
@@ -3040,24 +3021,8 @@ iput_tmp_ino_err_out_now: | |||
3040 | if (vol->mft_ino && vol->mft_ino != tmp_ino) | 3021 | if (vol->mft_ino && vol->mft_ino != tmp_ino) |
3041 | iput(vol->mft_ino); | 3022 | iput(vol->mft_ino); |
3042 | vol->mft_ino = NULL; | 3023 | vol->mft_ino = NULL; |
3043 | /* | ||
3044 | * This is needed to get ntfs_clear_extent_inode() called for each | ||
3045 | * inode we have ever called ntfs_iget()/iput() on, otherwise we A) | ||
3046 | * leak resources and B) a subsequent mount fails automatically due to | ||
3047 | * ntfs_iget() never calling down into our ntfs_read_locked_inode() | ||
3048 | * method again... FIXME: Do we need to do this twice now because of | ||
3049 | * attribute inodes? I think not, so leave as is for now... (AIA) | ||
3050 | */ | ||
3051 | if (invalidate_inodes(sb)) { | ||
3052 | ntfs_error(sb, "Busy inodes left. This is most likely a NTFS " | ||
3053 | "driver bug."); | ||
3054 | /* Copied from fs/super.c. I just love this message. (-; */ | ||
3055 | printk("NTFS: Busy inodes after umount. Self-destruct in 5 " | ||
3056 | "seconds. Have a nice day...\n"); | ||
3057 | } | ||
3058 | /* Errors at this stage are irrelevant. */ | 3024 | /* Errors at this stage are irrelevant. */ |
3059 | err_out_now: | 3025 | err_out_now: |
3060 | lock_kernel(); | ||
3061 | sb->s_fs_info = NULL; | 3026 | sb->s_fs_info = NULL; |
3062 | kfree(vol); | 3027 | kfree(vol); |
3063 | ntfs_debug("Failed, returning -EINVAL."); | 3028 | ntfs_debug("Failed, returning -EINVAL."); |
@@ -3094,17 +3059,16 @@ struct kmem_cache *ntfs_index_ctx_cache; | |||
3094 | /* Driver wide mutex. */ | 3059 | /* Driver wide mutex. */ |
3095 | DEFINE_MUTEX(ntfs_lock); | 3060 | DEFINE_MUTEX(ntfs_lock); |
3096 | 3061 | ||
3097 | static int ntfs_get_sb(struct file_system_type *fs_type, | 3062 | static struct dentry *ntfs_mount(struct file_system_type *fs_type, |
3098 | int flags, const char *dev_name, void *data, struct vfsmount *mnt) | 3063 | int flags, const char *dev_name, void *data) |
3099 | { | 3064 | { |
3100 | return get_sb_bdev(fs_type, flags, dev_name, data, ntfs_fill_super, | 3065 | return mount_bdev(fs_type, flags, dev_name, data, ntfs_fill_super); |
3101 | mnt); | ||
3102 | } | 3066 | } |
3103 | 3067 | ||
3104 | static struct file_system_type ntfs_fs_type = { | 3068 | static struct file_system_type ntfs_fs_type = { |
3105 | .owner = THIS_MODULE, | 3069 | .owner = THIS_MODULE, |
3106 | .name = "ntfs", | 3070 | .name = "ntfs", |
3107 | .get_sb = ntfs_get_sb, | 3071 | .mount = ntfs_mount, |
3108 | .kill_sb = kill_block_super, | 3072 | .kill_sb = kill_block_super, |
3109 | .fs_flags = FS_REQUIRES_DEV, | 3073 | .fs_flags = FS_REQUIRES_DEV, |
3110 | }; | 3074 | }; |
@@ -3229,8 +3193,8 @@ static void __exit exit_ntfs_fs(void) | |||
3229 | ntfs_sysctl(0); | 3193 | ntfs_sysctl(0); |
3230 | } | 3194 | } |
3231 | 3195 | ||
3232 | MODULE_AUTHOR("Anton Altaparmakov <aia21@cantab.net>"); | 3196 | MODULE_AUTHOR("Anton Altaparmakov <anton@tuxera.com>"); |
3233 | MODULE_DESCRIPTION("NTFS 1.2/3.x driver - Copyright (c) 2001-2007 Anton Altaparmakov"); | 3197 | MODULE_DESCRIPTION("NTFS 1.2/3.x driver - Copyright (c) 2001-2011 Anton Altaparmakov and Tuxera Inc."); |
3234 | MODULE_VERSION(NTFS_VERSION); | 3198 | MODULE_VERSION(NTFS_VERSION); |
3235 | MODULE_LICENSE("GPL"); | 3199 | MODULE_LICENSE("GPL"); |
3236 | #ifdef DEBUG | 3200 | #ifdef DEBUG |