diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2006-08-06 18:44:39 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-08-06 18:44:39 -0400 |
commit | dbd43d08642c037beb937c2670976c076120507b (patch) | |
tree | 4d44a4b54a731eb290e040345c38ed9e1e7ecc6a /fs | |
parent | c34c07d6946ec8969fa71ba03dbb95091f4eb9d3 (diff) | |
parent | 9f737633e6ee54fc174282d49b2559bd2208391d (diff) |
Merge branch 'master' of /home/greg/linux/git/torvalds-2.6/
Diffstat (limited to 'fs')
-rw-r--r-- | fs/befs/linuxvfs.c | 11 | ||||
-rw-r--r-- | fs/reiserfs/file.c | 2 | ||||
-rw-r--r-- | fs/reiserfs/inode.c | 26 | ||||
-rw-r--r-- | fs/reiserfs/ioctl.c | 2 | ||||
-rw-r--r-- | fs/udf/ialloc.c | 11 | ||||
-rw-r--r-- | fs/ufs/balloc.c | 2 | ||||
-rw-r--r-- | fs/ufs/util.c | 17 |
7 files changed, 41 insertions, 30 deletions
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c index fcaeead9696b..50cfca5c7efd 100644 --- a/fs/befs/linuxvfs.c +++ b/fs/befs/linuxvfs.c | |||
@@ -512,7 +512,11 @@ befs_utf2nls(struct super_block *sb, const char *in, | |||
512 | wchar_t uni; | 512 | wchar_t uni; |
513 | int unilen, utflen; | 513 | int unilen, utflen; |
514 | char *result; | 514 | char *result; |
515 | int maxlen = in_len; /* The utf8->nls conversion can't make more chars */ | 515 | /* The utf8->nls conversion won't make the final nls string bigger |
516 | * than the utf one, but if the string is pure ascii they'll have the | ||
517 | * same width and an extra char is needed to save the additional \0 | ||
518 | */ | ||
519 | int maxlen = in_len + 1; | ||
516 | 520 | ||
517 | befs_debug(sb, "---> utf2nls()"); | 521 | befs_debug(sb, "---> utf2nls()"); |
518 | 522 | ||
@@ -588,7 +592,10 @@ befs_nls2utf(struct super_block *sb, const char *in, | |||
588 | wchar_t uni; | 592 | wchar_t uni; |
589 | int unilen, utflen; | 593 | int unilen, utflen; |
590 | char *result; | 594 | char *result; |
591 | int maxlen = 3 * in_len; | 595 | /* There're nls characters that will translate to 3-chars-wide UTF-8 |
596 | * characters, a additional byte is needed to save the final \0 | ||
597 | * in special cases */ | ||
598 | int maxlen = (3 * in_len) + 1; | ||
592 | 599 | ||
593 | befs_debug(sb, "---> nls2utf()\n"); | 600 | befs_debug(sb, "---> nls2utf()\n"); |
594 | 601 | ||
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c index f318b58510fd..1627edd50810 100644 --- a/fs/reiserfs/file.c +++ b/fs/reiserfs/file.c | |||
@@ -48,8 +48,8 @@ static int reiserfs_file_release(struct inode *inode, struct file *filp) | |||
48 | return 0; | 48 | return 0; |
49 | } | 49 | } |
50 | 50 | ||
51 | reiserfs_write_lock(inode->i_sb); | ||
52 | mutex_lock(&inode->i_mutex); | 51 | mutex_lock(&inode->i_mutex); |
52 | reiserfs_write_lock(inode->i_sb); | ||
53 | /* freeing preallocation only involves relogging blocks that | 53 | /* freeing preallocation only involves relogging blocks that |
54 | * are already in the current transaction. preallocation gets | 54 | * are already in the current transaction. preallocation gets |
55 | * freed at the end of each transaction, so it is impossible for | 55 | * freed at the end of each transaction, so it is impossible for |
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index 12dfdcfbee3d..52f1e2136546 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -39,14 +39,10 @@ void reiserfs_delete_inode(struct inode *inode) | |||
39 | 39 | ||
40 | /* The = 0 happens when we abort creating a new inode for some reason like lack of space.. */ | 40 | /* The = 0 happens when we abort creating a new inode for some reason like lack of space.. */ |
41 | if (!(inode->i_state & I_NEW) && INODE_PKEY(inode)->k_objectid != 0) { /* also handles bad_inode case */ | 41 | if (!(inode->i_state & I_NEW) && INODE_PKEY(inode)->k_objectid != 0) { /* also handles bad_inode case */ |
42 | mutex_lock(&inode->i_mutex); | ||
43 | |||
44 | reiserfs_delete_xattrs(inode); | 42 | reiserfs_delete_xattrs(inode); |
45 | 43 | ||
46 | if (journal_begin(&th, inode->i_sb, jbegin_count)) { | 44 | if (journal_begin(&th, inode->i_sb, jbegin_count)) |
47 | mutex_unlock(&inode->i_mutex); | ||
48 | goto out; | 45 | goto out; |
49 | } | ||
50 | reiserfs_update_inode_transaction(inode); | 46 | reiserfs_update_inode_transaction(inode); |
51 | 47 | ||
52 | err = reiserfs_delete_object(&th, inode); | 48 | err = reiserfs_delete_object(&th, inode); |
@@ -57,12 +53,8 @@ void reiserfs_delete_inode(struct inode *inode) | |||
57 | if (!err) | 53 | if (!err) |
58 | DQUOT_FREE_INODE(inode); | 54 | DQUOT_FREE_INODE(inode); |
59 | 55 | ||
60 | if (journal_end(&th, inode->i_sb, jbegin_count)) { | 56 | if (journal_end(&th, inode->i_sb, jbegin_count)) |
61 | mutex_unlock(&inode->i_mutex); | ||
62 | goto out; | 57 | goto out; |
63 | } | ||
64 | |||
65 | mutex_unlock(&inode->i_mutex); | ||
66 | 58 | ||
67 | /* check return value from reiserfs_delete_object after | 59 | /* check return value from reiserfs_delete_object after |
68 | * ending the transaction | 60 | * ending the transaction |
@@ -2348,6 +2340,7 @@ static int reiserfs_write_full_page(struct page *page, | |||
2348 | unsigned long end_index = inode->i_size >> PAGE_CACHE_SHIFT; | 2340 | unsigned long end_index = inode->i_size >> PAGE_CACHE_SHIFT; |
2349 | int error = 0; | 2341 | int error = 0; |
2350 | unsigned long block; | 2342 | unsigned long block; |
2343 | sector_t last_block; | ||
2351 | struct buffer_head *head, *bh; | 2344 | struct buffer_head *head, *bh; |
2352 | int partial = 0; | 2345 | int partial = 0; |
2353 | int nr = 0; | 2346 | int nr = 0; |
@@ -2395,10 +2388,19 @@ static int reiserfs_write_full_page(struct page *page, | |||
2395 | } | 2388 | } |
2396 | bh = head; | 2389 | bh = head; |
2397 | block = page->index << (PAGE_CACHE_SHIFT - s->s_blocksize_bits); | 2390 | block = page->index << (PAGE_CACHE_SHIFT - s->s_blocksize_bits); |
2391 | last_block = (i_size_read(inode) - 1) >> inode->i_blkbits; | ||
2398 | /* first map all the buffers, logging any direct items we find */ | 2392 | /* first map all the buffers, logging any direct items we find */ |
2399 | do { | 2393 | do { |
2400 | if ((checked || buffer_dirty(bh)) && (!buffer_mapped(bh) || | 2394 | if (block > last_block) { |
2401 | (buffer_mapped(bh) | 2395 | /* |
2396 | * This can happen when the block size is less than | ||
2397 | * the page size. The corresponding bytes in the page | ||
2398 | * were zero filled above | ||
2399 | */ | ||
2400 | clear_buffer_dirty(bh); | ||
2401 | set_buffer_uptodate(bh); | ||
2402 | } else if ((checked || buffer_dirty(bh)) && | ||
2403 | (!buffer_mapped(bh) || (buffer_mapped(bh) | ||
2402 | && bh->b_blocknr == | 2404 | && bh->b_blocknr == |
2403 | 0))) { | 2405 | 0))) { |
2404 | /* not mapped yet, or it points to a direct item, search | 2406 | /* not mapped yet, or it points to a direct item, search |
diff --git a/fs/reiserfs/ioctl.c b/fs/reiserfs/ioctl.c index 745c88100895..a986b5e1e288 100644 --- a/fs/reiserfs/ioctl.c +++ b/fs/reiserfs/ioctl.c | |||
@@ -116,12 +116,12 @@ static int reiserfs_unpack(struct inode *inode, struct file *filp) | |||
116 | if (REISERFS_I(inode)->i_flags & i_nopack_mask) { | 116 | if (REISERFS_I(inode)->i_flags & i_nopack_mask) { |
117 | return 0; | 117 | return 0; |
118 | } | 118 | } |
119 | reiserfs_write_lock(inode->i_sb); | ||
120 | 119 | ||
121 | /* we need to make sure nobody is changing the file size beneath | 120 | /* we need to make sure nobody is changing the file size beneath |
122 | ** us | 121 | ** us |
123 | */ | 122 | */ |
124 | mutex_lock(&inode->i_mutex); | 123 | mutex_lock(&inode->i_mutex); |
124 | reiserfs_write_lock(inode->i_sb); | ||
125 | 125 | ||
126 | write_from = inode->i_size & (blocksize - 1); | 126 | write_from = inode->i_size & (blocksize - 1); |
127 | /* if we are on a block boundary, we are already unpacked. */ | 127 | /* if we are on a block boundary, we are already unpacked. */ |
diff --git a/fs/udf/ialloc.c b/fs/udf/ialloc.c index 3873c672cb4c..33323473e3c4 100644 --- a/fs/udf/ialloc.c +++ b/fs/udf/ialloc.c | |||
@@ -75,6 +75,12 @@ struct inode * udf_new_inode (struct inode *dir, int mode, int * err) | |||
75 | } | 75 | } |
76 | *err = -ENOSPC; | 76 | *err = -ENOSPC; |
77 | 77 | ||
78 | UDF_I_UNIQUE(inode) = 0; | ||
79 | UDF_I_LENEXTENTS(inode) = 0; | ||
80 | UDF_I_NEXT_ALLOC_BLOCK(inode) = 0; | ||
81 | UDF_I_NEXT_ALLOC_GOAL(inode) = 0; | ||
82 | UDF_I_STRAT4096(inode) = 0; | ||
83 | |||
78 | block = udf_new_block(dir->i_sb, NULL, UDF_I_LOCATION(dir).partitionReferenceNum, | 84 | block = udf_new_block(dir->i_sb, NULL, UDF_I_LOCATION(dir).partitionReferenceNum, |
79 | start, err); | 85 | start, err); |
80 | if (*err) | 86 | if (*err) |
@@ -84,11 +90,6 @@ struct inode * udf_new_inode (struct inode *dir, int mode, int * err) | |||
84 | } | 90 | } |
85 | 91 | ||
86 | mutex_lock(&sbi->s_alloc_mutex); | 92 | mutex_lock(&sbi->s_alloc_mutex); |
87 | UDF_I_UNIQUE(inode) = 0; | ||
88 | UDF_I_LENEXTENTS(inode) = 0; | ||
89 | UDF_I_NEXT_ALLOC_BLOCK(inode) = 0; | ||
90 | UDF_I_NEXT_ALLOC_GOAL(inode) = 0; | ||
91 | UDF_I_STRAT4096(inode) = 0; | ||
92 | if (UDF_SB_LVIDBH(sb)) | 93 | if (UDF_SB_LVIDBH(sb)) |
93 | { | 94 | { |
94 | struct logicalVolHeaderDesc *lvhd; | 95 | struct logicalVolHeaderDesc *lvhd; |
diff --git a/fs/ufs/balloc.c b/fs/ufs/balloc.c index b01804baa120..b82381475779 100644 --- a/fs/ufs/balloc.c +++ b/fs/ufs/balloc.c | |||
@@ -248,7 +248,7 @@ static void ufs_change_blocknr(struct inode *inode, unsigned int baseblk, | |||
248 | 248 | ||
249 | if (likely(cur_index != index)) { | 249 | if (likely(cur_index != index)) { |
250 | page = ufs_get_locked_page(mapping, index); | 250 | page = ufs_get_locked_page(mapping, index); |
251 | if (IS_ERR(page)) | 251 | if (!page || IS_ERR(page)) /* it was truncated or EIO */ |
252 | continue; | 252 | continue; |
253 | } else | 253 | } else |
254 | page = locked_page; | 254 | page = locked_page; |
diff --git a/fs/ufs/util.c b/fs/ufs/util.c index 337cf2c46d10..22f820a9b15c 100644 --- a/fs/ufs/util.c +++ b/fs/ufs/util.c | |||
@@ -251,12 +251,12 @@ struct page *ufs_get_locked_page(struct address_space *mapping, | |||
251 | { | 251 | { |
252 | struct page *page; | 252 | struct page *page; |
253 | 253 | ||
254 | try_again: | ||
255 | page = find_lock_page(mapping, index); | 254 | page = find_lock_page(mapping, index); |
256 | if (!page) { | 255 | if (!page) { |
257 | page = read_cache_page(mapping, index, | 256 | page = read_cache_page(mapping, index, |
258 | (filler_t*)mapping->a_ops->readpage, | 257 | (filler_t*)mapping->a_ops->readpage, |
259 | NULL); | 258 | NULL); |
259 | |||
260 | if (IS_ERR(page)) { | 260 | if (IS_ERR(page)) { |
261 | printk(KERN_ERR "ufs_change_blocknr: " | 261 | printk(KERN_ERR "ufs_change_blocknr: " |
262 | "read_cache_page error: ino %lu, index: %lu\n", | 262 | "read_cache_page error: ino %lu, index: %lu\n", |
@@ -266,6 +266,14 @@ try_again: | |||
266 | 266 | ||
267 | lock_page(page); | 267 | lock_page(page); |
268 | 268 | ||
269 | if (unlikely(page->mapping == NULL)) { | ||
270 | /* Truncate got there first */ | ||
271 | unlock_page(page); | ||
272 | page_cache_release(page); | ||
273 | page = NULL; | ||
274 | goto out; | ||
275 | } | ||
276 | |||
269 | if (!PageUptodate(page) || PageError(page)) { | 277 | if (!PageUptodate(page) || PageError(page)) { |
270 | unlock_page(page); | 278 | unlock_page(page); |
271 | page_cache_release(page); | 279 | page_cache_release(page); |
@@ -275,15 +283,8 @@ try_again: | |||
275 | mapping->host->i_ino, index); | 283 | mapping->host->i_ino, index); |
276 | 284 | ||
277 | page = ERR_PTR(-EIO); | 285 | page = ERR_PTR(-EIO); |
278 | goto out; | ||
279 | } | 286 | } |
280 | } | 287 | } |
281 | |||
282 | if (unlikely(!page->mapping || !page_has_buffers(page))) { | ||
283 | unlock_page(page); | ||
284 | page_cache_release(page); | ||
285 | goto try_again;/*we really need these buffers*/ | ||
286 | } | ||
287 | out: | 288 | out: |
288 | return page; | 289 | return page; |
289 | } | 290 | } |