diff options
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/bio.c | 11 | ||||
| -rw-r--r-- | fs/block_dev.c | 3 | ||||
| -rw-r--r-- | fs/buffer.c | 66 | ||||
| -rw-r--r-- | fs/direct-io.c | 5 | ||||
| -rw-r--r-- | fs/jbd/journal.c | 5 | ||||
| -rw-r--r-- | fs/nfsd/nfs4callback.c | 4 | ||||
| -rw-r--r-- | fs/nfsd/state.h | 1 | ||||
| -rw-r--r-- | fs/quota/dquot.c | 2 | ||||
| -rw-r--r-- | fs/reiserfs/bitmap.c | 2 | ||||
| -rw-r--r-- | fs/reiserfs/inode.c | 2 | ||||
| -rw-r--r-- | fs/ubifs/debug.h | 2 | ||||
| -rw-r--r-- | fs/ubifs/lpt.c | 5 | ||||
| -rw-r--r-- | fs/ubifs/recovery.c | 2 | ||||
| -rw-r--r-- | fs/ubifs/replay.c | 3 | ||||
| -rw-r--r-- | fs/ubifs/super.c | 3 | ||||
| -rw-r--r-- | fs/udf/inode.c | 5 | ||||
| -rw-r--r-- | fs/udf/super.c | 7 | ||||
| -rw-r--r-- | fs/xfs/xfs_discard.c | 6 | ||||
| -rw-r--r-- | fs/xfs/xfs_ialloc.c | 17 | ||||
| -rw-r--r-- | fs/xfs/xfs_rtalloc.c | 2 |
20 files changed, 84 insertions, 69 deletions
| @@ -73,7 +73,7 @@ static struct kmem_cache *bio_find_or_create_slab(unsigned int extra_size) | |||
| 73 | { | 73 | { |
| 74 | unsigned int sz = sizeof(struct bio) + extra_size; | 74 | unsigned int sz = sizeof(struct bio) + extra_size; |
| 75 | struct kmem_cache *slab = NULL; | 75 | struct kmem_cache *slab = NULL; |
| 76 | struct bio_slab *bslab; | 76 | struct bio_slab *bslab, *new_bio_slabs; |
| 77 | unsigned int i, entry = -1; | 77 | unsigned int i, entry = -1; |
| 78 | 78 | ||
| 79 | mutex_lock(&bio_slab_lock); | 79 | mutex_lock(&bio_slab_lock); |
| @@ -97,11 +97,12 @@ static struct kmem_cache *bio_find_or_create_slab(unsigned int extra_size) | |||
| 97 | 97 | ||
| 98 | if (bio_slab_nr == bio_slab_max && entry == -1) { | 98 | if (bio_slab_nr == bio_slab_max && entry == -1) { |
| 99 | bio_slab_max <<= 1; | 99 | bio_slab_max <<= 1; |
| 100 | bio_slabs = krealloc(bio_slabs, | 100 | new_bio_slabs = krealloc(bio_slabs, |
| 101 | bio_slab_max * sizeof(struct bio_slab), | 101 | bio_slab_max * sizeof(struct bio_slab), |
| 102 | GFP_KERNEL); | 102 | GFP_KERNEL); |
| 103 | if (!bio_slabs) | 103 | if (!new_bio_slabs) |
| 104 | goto out_unlock; | 104 | goto out_unlock; |
| 105 | bio_slabs = new_bio_slabs; | ||
| 105 | } | 106 | } |
| 106 | if (entry == -1) | 107 | if (entry == -1) |
| 107 | entry = bio_slab_nr++; | 108 | entry = bio_slab_nr++; |
diff --git a/fs/block_dev.c b/fs/block_dev.c index 1e519195d45b..38e721b35d45 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
| @@ -1578,10 +1578,12 @@ ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
| 1578 | unsigned long nr_segs, loff_t pos) | 1578 | unsigned long nr_segs, loff_t pos) |
| 1579 | { | 1579 | { |
| 1580 | struct file *file = iocb->ki_filp; | 1580 | struct file *file = iocb->ki_filp; |
| 1581 | struct blk_plug plug; | ||
| 1581 | ssize_t ret; | 1582 | ssize_t ret; |
| 1582 | 1583 | ||
| 1583 | BUG_ON(iocb->ki_pos != pos); | 1584 | BUG_ON(iocb->ki_pos != pos); |
| 1584 | 1585 | ||
| 1586 | blk_start_plug(&plug); | ||
| 1585 | ret = __generic_file_aio_write(iocb, iov, nr_segs, &iocb->ki_pos); | 1587 | ret = __generic_file_aio_write(iocb, iov, nr_segs, &iocb->ki_pos); |
| 1586 | if (ret > 0 || ret == -EIOCBQUEUED) { | 1588 | if (ret > 0 || ret == -EIOCBQUEUED) { |
| 1587 | ssize_t err; | 1589 | ssize_t err; |
| @@ -1590,6 +1592,7 @@ ssize_t blkdev_aio_write(struct kiocb *iocb, const struct iovec *iov, | |||
| 1590 | if (err < 0 && ret > 0) | 1592 | if (err < 0 && ret > 0) |
| 1591 | ret = err; | 1593 | ret = err; |
| 1592 | } | 1594 | } |
| 1595 | blk_finish_plug(&plug); | ||
| 1593 | return ret; | 1596 | return ret; |
| 1594 | } | 1597 | } |
| 1595 | EXPORT_SYMBOL_GPL(blkdev_aio_write); | 1598 | EXPORT_SYMBOL_GPL(blkdev_aio_write); |
diff --git a/fs/buffer.c b/fs/buffer.c index 9f6d2e41281d..58e2e7b77372 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
| @@ -914,7 +914,7 @@ link_dev_buffers(struct page *page, struct buffer_head *head) | |||
| 914 | /* | 914 | /* |
| 915 | * Initialise the state of a blockdev page's buffers. | 915 | * Initialise the state of a blockdev page's buffers. |
| 916 | */ | 916 | */ |
| 917 | static void | 917 | static sector_t |
| 918 | init_page_buffers(struct page *page, struct block_device *bdev, | 918 | init_page_buffers(struct page *page, struct block_device *bdev, |
| 919 | sector_t block, int size) | 919 | sector_t block, int size) |
| 920 | { | 920 | { |
| @@ -936,33 +936,41 @@ init_page_buffers(struct page *page, struct block_device *bdev, | |||
| 936 | block++; | 936 | block++; |
| 937 | bh = bh->b_this_page; | 937 | bh = bh->b_this_page; |
| 938 | } while (bh != head); | 938 | } while (bh != head); |
| 939 | |||
| 940 | /* | ||
| 941 | * Caller needs to validate requested block against end of device. | ||
| 942 | */ | ||
| 943 | return end_block; | ||
| 939 | } | 944 | } |
| 940 | 945 | ||
| 941 | /* | 946 | /* |
| 942 | * Create the page-cache page that contains the requested block. | 947 | * Create the page-cache page that contains the requested block. |
| 943 | * | 948 | * |
| 944 | * This is user purely for blockdev mappings. | 949 | * This is used purely for blockdev mappings. |
| 945 | */ | 950 | */ |
| 946 | static struct page * | 951 | static int |
| 947 | grow_dev_page(struct block_device *bdev, sector_t block, | 952 | grow_dev_page(struct block_device *bdev, sector_t block, |
| 948 | pgoff_t index, int size) | 953 | pgoff_t index, int size, int sizebits) |
| 949 | { | 954 | { |
| 950 | struct inode *inode = bdev->bd_inode; | 955 | struct inode *inode = bdev->bd_inode; |
| 951 | struct page *page; | 956 | struct page *page; |
| 952 | struct buffer_head *bh; | 957 | struct buffer_head *bh; |
| 958 | sector_t end_block; | ||
| 959 | int ret = 0; /* Will call free_more_memory() */ | ||
| 953 | 960 | ||
| 954 | page = find_or_create_page(inode->i_mapping, index, | 961 | page = find_or_create_page(inode->i_mapping, index, |
| 955 | (mapping_gfp_mask(inode->i_mapping) & ~__GFP_FS)|__GFP_MOVABLE); | 962 | (mapping_gfp_mask(inode->i_mapping) & ~__GFP_FS)|__GFP_MOVABLE); |
| 956 | if (!page) | 963 | if (!page) |
| 957 | return NULL; | 964 | return ret; |
| 958 | 965 | ||
| 959 | BUG_ON(!PageLocked(page)); | 966 | BUG_ON(!PageLocked(page)); |
| 960 | 967 | ||
| 961 | if (page_has_buffers(page)) { | 968 | if (page_has_buffers(page)) { |
| 962 | bh = page_buffers(page); | 969 | bh = page_buffers(page); |
| 963 | if (bh->b_size == size) { | 970 | if (bh->b_size == size) { |
| 964 | init_page_buffers(page, bdev, block, size); | 971 | end_block = init_page_buffers(page, bdev, |
| 965 | return page; | 972 | index << sizebits, size); |
| 973 | goto done; | ||
| 966 | } | 974 | } |
| 967 | if (!try_to_free_buffers(page)) | 975 | if (!try_to_free_buffers(page)) |
| 968 | goto failed; | 976 | goto failed; |
| @@ -982,14 +990,14 @@ grow_dev_page(struct block_device *bdev, sector_t block, | |||
| 982 | */ | 990 | */ |
| 983 | spin_lock(&inode->i_mapping->private_lock); | 991 | spin_lock(&inode->i_mapping->private_lock); |
| 984 | link_dev_buffers(page, bh); | 992 | link_dev_buffers(page, bh); |
| 985 | init_page_buffers(page, bdev, block, size); | 993 | end_block = init_page_buffers(page, bdev, index << sizebits, size); |
| 986 | spin_unlock(&inode->i_mapping->private_lock); | 994 | spin_unlock(&inode->i_mapping->private_lock); |
| 987 | return page; | 995 | done: |
| 988 | 996 | ret = (block < end_block) ? 1 : -ENXIO; | |
| 989 | failed: | 997 | failed: |
| 990 | unlock_page(page); | 998 | unlock_page(page); |
| 991 | page_cache_release(page); | 999 | page_cache_release(page); |
| 992 | return NULL; | 1000 | return ret; |
| 993 | } | 1001 | } |
| 994 | 1002 | ||
| 995 | /* | 1003 | /* |
| @@ -999,7 +1007,6 @@ failed: | |||
| 999 | static int | 1007 | static int |
| 1000 | grow_buffers(struct block_device *bdev, sector_t block, int size) | 1008 | grow_buffers(struct block_device *bdev, sector_t block, int size) |
| 1001 | { | 1009 | { |
| 1002 | struct page *page; | ||
| 1003 | pgoff_t index; | 1010 | pgoff_t index; |
| 1004 | int sizebits; | 1011 | int sizebits; |
| 1005 | 1012 | ||
| @@ -1023,22 +1030,14 @@ grow_buffers(struct block_device *bdev, sector_t block, int size) | |||
| 1023 | bdevname(bdev, b)); | 1030 | bdevname(bdev, b)); |
| 1024 | return -EIO; | 1031 | return -EIO; |
| 1025 | } | 1032 | } |
| 1026 | block = index << sizebits; | 1033 | |
| 1027 | /* Create a page with the proper size buffers.. */ | 1034 | /* Create a page with the proper size buffers.. */ |
| 1028 | page = grow_dev_page(bdev, block, index, size); | 1035 | return grow_dev_page(bdev, block, index, size, sizebits); |
| 1029 | if (!page) | ||
| 1030 | return 0; | ||
| 1031 | unlock_page(page); | ||
| 1032 | page_cache_release(page); | ||
| 1033 | return 1; | ||
| 1034 | } | 1036 | } |
| 1035 | 1037 | ||
| 1036 | static struct buffer_head * | 1038 | static struct buffer_head * |
| 1037 | __getblk_slow(struct block_device *bdev, sector_t block, int size) | 1039 | __getblk_slow(struct block_device *bdev, sector_t block, int size) |
| 1038 | { | 1040 | { |
| 1039 | int ret; | ||
| 1040 | struct buffer_head *bh; | ||
| 1041 | |||
| 1042 | /* Size must be multiple of hard sectorsize */ | 1041 | /* Size must be multiple of hard sectorsize */ |
| 1043 | if (unlikely(size & (bdev_logical_block_size(bdev)-1) || | 1042 | if (unlikely(size & (bdev_logical_block_size(bdev)-1) || |
| 1044 | (size < 512 || size > PAGE_SIZE))) { | 1043 | (size < 512 || size > PAGE_SIZE))) { |
| @@ -1051,21 +1050,20 @@ __getblk_slow(struct block_device *bdev, sector_t block, int size) | |||
| 1051 | return NULL; | 1050 | return NULL; |
| 1052 | } | 1051 | } |
| 1053 | 1052 | ||
| 1054 | retry: | 1053 | for (;;) { |
| 1055 | bh = __find_get_block(bdev, block, size); | 1054 | struct buffer_head *bh; |
| 1056 | if (bh) | 1055 | int ret; |
| 1057 | return bh; | ||
| 1058 | 1056 | ||
| 1059 | ret = grow_buffers(bdev, block, size); | ||
| 1060 | if (ret == 0) { | ||
| 1061 | free_more_memory(); | ||
| 1062 | goto retry; | ||
| 1063 | } else if (ret > 0) { | ||
| 1064 | bh = __find_get_block(bdev, block, size); | 1057 | bh = __find_get_block(bdev, block, size); |
| 1065 | if (bh) | 1058 | if (bh) |
| 1066 | return bh; | 1059 | return bh; |
| 1060 | |||
| 1061 | ret = grow_buffers(bdev, block, size); | ||
| 1062 | if (ret < 0) | ||
| 1063 | return NULL; | ||
| 1064 | if (ret == 0) | ||
| 1065 | free_more_memory(); | ||
| 1067 | } | 1066 | } |
| 1068 | return NULL; | ||
| 1069 | } | 1067 | } |
| 1070 | 1068 | ||
| 1071 | /* | 1069 | /* |
| @@ -1321,10 +1319,6 @@ EXPORT_SYMBOL(__find_get_block); | |||
| 1321 | * which corresponds to the passed block_device, block and size. The | 1319 | * which corresponds to the passed block_device, block and size. The |
| 1322 | * returned buffer has its reference count incremented. | 1320 | * returned buffer has its reference count incremented. |
| 1323 | * | 1321 | * |
| 1324 | * __getblk() cannot fail - it just keeps trying. If you pass it an | ||
| 1325 | * illegal block number, __getblk() will happily return a buffer_head | ||
| 1326 | * which represents the non-existent block. Very weird. | ||
| 1327 | * | ||
| 1328 | * __getblk() will lock up the machine if grow_dev_page's try_to_free_buffers() | 1322 | * __getblk() will lock up the machine if grow_dev_page's try_to_free_buffers() |
| 1329 | * attempt is failing. FIXME, perhaps? | 1323 | * attempt is failing. FIXME, perhaps? |
| 1330 | */ | 1324 | */ |
diff --git a/fs/direct-io.c b/fs/direct-io.c index 1faf4cb56f39..f86c720dba0e 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c | |||
| @@ -1062,6 +1062,7 @@ do_blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, | |||
| 1062 | unsigned long user_addr; | 1062 | unsigned long user_addr; |
| 1063 | size_t bytes; | 1063 | size_t bytes; |
| 1064 | struct buffer_head map_bh = { 0, }; | 1064 | struct buffer_head map_bh = { 0, }; |
| 1065 | struct blk_plug plug; | ||
| 1065 | 1066 | ||
| 1066 | if (rw & WRITE) | 1067 | if (rw & WRITE) |
| 1067 | rw = WRITE_ODIRECT; | 1068 | rw = WRITE_ODIRECT; |
| @@ -1177,6 +1178,8 @@ do_blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, | |||
| 1177 | PAGE_SIZE - user_addr / PAGE_SIZE); | 1178 | PAGE_SIZE - user_addr / PAGE_SIZE); |
| 1178 | } | 1179 | } |
| 1179 | 1180 | ||
| 1181 | blk_start_plug(&plug); | ||
| 1182 | |||
| 1180 | for (seg = 0; seg < nr_segs; seg++) { | 1183 | for (seg = 0; seg < nr_segs; seg++) { |
| 1181 | user_addr = (unsigned long)iov[seg].iov_base; | 1184 | user_addr = (unsigned long)iov[seg].iov_base; |
| 1182 | sdio.size += bytes = iov[seg].iov_len; | 1185 | sdio.size += bytes = iov[seg].iov_len; |
| @@ -1235,6 +1238,8 @@ do_blockdev_direct_IO(int rw, struct kiocb *iocb, struct inode *inode, | |||
| 1235 | if (sdio.bio) | 1238 | if (sdio.bio) |
| 1236 | dio_bio_submit(dio, &sdio); | 1239 | dio_bio_submit(dio, &sdio); |
| 1237 | 1240 | ||
| 1241 | blk_finish_plug(&plug); | ||
| 1242 | |||
| 1238 | /* | 1243 | /* |
| 1239 | * It is possible that, we return short IO due to end of file. | 1244 | * It is possible that, we return short IO due to end of file. |
| 1240 | * In that case, we need to release all the pages we got hold on. | 1245 | * In that case, we need to release all the pages we got hold on. |
diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c index 09357508ec9a..a2862339323b 100644 --- a/fs/jbd/journal.c +++ b/fs/jbd/journal.c | |||
| @@ -1113,6 +1113,11 @@ static void mark_journal_empty(journal_t *journal) | |||
| 1113 | 1113 | ||
| 1114 | BUG_ON(!mutex_is_locked(&journal->j_checkpoint_mutex)); | 1114 | BUG_ON(!mutex_is_locked(&journal->j_checkpoint_mutex)); |
| 1115 | spin_lock(&journal->j_state_lock); | 1115 | spin_lock(&journal->j_state_lock); |
| 1116 | /* Is it already empty? */ | ||
| 1117 | if (sb->s_start == 0) { | ||
| 1118 | spin_unlock(&journal->j_state_lock); | ||
| 1119 | return; | ||
| 1120 | } | ||
| 1116 | jbd_debug(1, "JBD: Marking journal as empty (seq %d)\n", | 1121 | jbd_debug(1, "JBD: Marking journal as empty (seq %d)\n", |
| 1117 | journal->j_tail_sequence); | 1122 | journal->j_tail_sequence); |
| 1118 | 1123 | ||
diff --git a/fs/nfsd/nfs4callback.c b/fs/nfsd/nfs4callback.c index cbaf4f8bb7b7..4c7bd35b1876 100644 --- a/fs/nfsd/nfs4callback.c +++ b/fs/nfsd/nfs4callback.c | |||
| @@ -651,12 +651,12 @@ static int setup_callback_client(struct nfs4_client *clp, struct nfs4_cb_conn *c | |||
| 651 | 651 | ||
| 652 | if (clp->cl_minorversion == 0) { | 652 | if (clp->cl_minorversion == 0) { |
| 653 | if (!clp->cl_cred.cr_principal && | 653 | if (!clp->cl_cred.cr_principal && |
| 654 | (clp->cl_flavor >= RPC_AUTH_GSS_KRB5)) | 654 | (clp->cl_cred.cr_flavor >= RPC_AUTH_GSS_KRB5)) |
| 655 | return -EINVAL; | 655 | return -EINVAL; |
| 656 | args.client_name = clp->cl_cred.cr_principal; | 656 | args.client_name = clp->cl_cred.cr_principal; |
| 657 | args.prognumber = conn->cb_prog, | 657 | args.prognumber = conn->cb_prog, |
| 658 | args.protocol = XPRT_TRANSPORT_TCP; | 658 | args.protocol = XPRT_TRANSPORT_TCP; |
| 659 | args.authflavor = clp->cl_flavor; | 659 | args.authflavor = clp->cl_cred.cr_flavor; |
| 660 | clp->cl_cb_ident = conn->cb_ident; | 660 | clp->cl_cb_ident = conn->cb_ident; |
| 661 | } else { | 661 | } else { |
| 662 | if (!conn->cb_xprt) | 662 | if (!conn->cb_xprt) |
diff --git a/fs/nfsd/state.h b/fs/nfsd/state.h index e6173147f982..22bd0a66c356 100644 --- a/fs/nfsd/state.h +++ b/fs/nfsd/state.h | |||
| @@ -231,7 +231,6 @@ struct nfs4_client { | |||
| 231 | nfs4_verifier cl_verifier; /* generated by client */ | 231 | nfs4_verifier cl_verifier; /* generated by client */ |
| 232 | time_t cl_time; /* time of last lease renewal */ | 232 | time_t cl_time; /* time of last lease renewal */ |
| 233 | struct sockaddr_storage cl_addr; /* client ipaddress */ | 233 | struct sockaddr_storage cl_addr; /* client ipaddress */ |
| 234 | u32 cl_flavor; /* setclientid pseudoflavor */ | ||
| 235 | struct svc_cred cl_cred; /* setclientid principal */ | 234 | struct svc_cred cl_cred; /* setclientid principal */ |
| 236 | clientid_t cl_clientid; /* generated by server */ | 235 | clientid_t cl_clientid; /* generated by server */ |
| 237 | nfs4_verifier cl_confirm; /* generated by server */ | 236 | nfs4_verifier cl_confirm; /* generated by server */ |
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 36a29b753c79..c495a3055e2a 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c | |||
| @@ -1589,10 +1589,10 @@ int __dquot_alloc_space(struct inode *inode, qsize_t number, int flags) | |||
| 1589 | goto out; | 1589 | goto out; |
| 1590 | } | 1590 | } |
| 1591 | 1591 | ||
| 1592 | down_read(&sb_dqopt(inode->i_sb)->dqptr_sem); | ||
| 1593 | for (cnt = 0; cnt < MAXQUOTAS; cnt++) | 1592 | for (cnt = 0; cnt < MAXQUOTAS; cnt++) |
| 1594 | warn[cnt].w_type = QUOTA_NL_NOWARN; | 1593 | warn[cnt].w_type = QUOTA_NL_NOWARN; |
| 1595 | 1594 | ||
| 1595 | down_read(&sb_dqopt(inode->i_sb)->dqptr_sem); | ||
| 1596 | spin_lock(&dq_data_lock); | 1596 | spin_lock(&dq_data_lock); |
| 1597 | for (cnt = 0; cnt < MAXQUOTAS; cnt++) { | 1597 | for (cnt = 0; cnt < MAXQUOTAS; cnt++) { |
| 1598 | if (!dquots[cnt]) | 1598 | if (!dquots[cnt]) |
diff --git a/fs/reiserfs/bitmap.c b/fs/reiserfs/bitmap.c index 4c0c7d163d15..a98b7740a0fc 100644 --- a/fs/reiserfs/bitmap.c +++ b/fs/reiserfs/bitmap.c | |||
| @@ -1334,9 +1334,7 @@ struct buffer_head *reiserfs_read_bitmap_block(struct super_block *sb, | |||
| 1334 | else if (bitmap == 0) | 1334 | else if (bitmap == 0) |
| 1335 | block = (REISERFS_DISK_OFFSET_IN_BYTES >> sb->s_blocksize_bits) + 1; | 1335 | block = (REISERFS_DISK_OFFSET_IN_BYTES >> sb->s_blocksize_bits) + 1; |
| 1336 | 1336 | ||
| 1337 | reiserfs_write_unlock(sb); | ||
| 1338 | bh = sb_bread(sb, block); | 1337 | bh = sb_bread(sb, block); |
| 1339 | reiserfs_write_lock(sb); | ||
| 1340 | if (bh == NULL) | 1338 | if (bh == NULL) |
| 1341 | reiserfs_warning(sb, "sh-2029: %s: bitmap block (#%u) " | 1339 | reiserfs_warning(sb, "sh-2029: %s: bitmap block (#%u) " |
| 1342 | "reading failed", __func__, block); | 1340 | "reading failed", __func__, block); |
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index a6d4268fb6c1..855da58db145 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
| @@ -76,10 +76,10 @@ void reiserfs_evict_inode(struct inode *inode) | |||
| 76 | ; | 76 | ; |
| 77 | } | 77 | } |
| 78 | out: | 78 | out: |
| 79 | reiserfs_write_unlock_once(inode->i_sb, depth); | ||
| 79 | clear_inode(inode); /* note this must go after the journal_end to prevent deadlock */ | 80 | clear_inode(inode); /* note this must go after the journal_end to prevent deadlock */ |
| 80 | dquot_drop(inode); | 81 | dquot_drop(inode); |
| 81 | inode->i_blocks = 0; | 82 | inode->i_blocks = 0; |
| 82 | reiserfs_write_unlock_once(inode->i_sb, depth); | ||
| 83 | return; | 83 | return; |
| 84 | 84 | ||
| 85 | no_delete: | 85 | no_delete: |
diff --git a/fs/ubifs/debug.h b/fs/ubifs/debug.h index 8b8cc4e945f4..760de723dadb 100644 --- a/fs/ubifs/debug.h +++ b/fs/ubifs/debug.h | |||
| @@ -167,7 +167,7 @@ struct ubifs_global_debug_info { | |||
| 167 | #define ubifs_dbg_msg(type, fmt, ...) \ | 167 | #define ubifs_dbg_msg(type, fmt, ...) \ |
| 168 | pr_debug("UBIFS DBG " type ": " fmt "\n", ##__VA_ARGS__) | 168 | pr_debug("UBIFS DBG " type ": " fmt "\n", ##__VA_ARGS__) |
| 169 | 169 | ||
| 170 | #define DBG_KEY_BUF_LEN 32 | 170 | #define DBG_KEY_BUF_LEN 48 |
| 171 | #define ubifs_dbg_msg_key(type, key, fmt, ...) do { \ | 171 | #define ubifs_dbg_msg_key(type, key, fmt, ...) do { \ |
| 172 | char __tmp_key_buf[DBG_KEY_BUF_LEN]; \ | 172 | char __tmp_key_buf[DBG_KEY_BUF_LEN]; \ |
| 173 | pr_debug("UBIFS DBG " type ": " fmt "%s\n", ##__VA_ARGS__, \ | 173 | pr_debug("UBIFS DBG " type ": " fmt "%s\n", ##__VA_ARGS__, \ |
diff --git a/fs/ubifs/lpt.c b/fs/ubifs/lpt.c index ce33b2beb151..8640920766ed 100644 --- a/fs/ubifs/lpt.c +++ b/fs/ubifs/lpt.c | |||
| @@ -1749,7 +1749,10 @@ int ubifs_lpt_init(struct ubifs_info *c, int rd, int wr) | |||
| 1749 | return 0; | 1749 | return 0; |
| 1750 | 1750 | ||
| 1751 | out_err: | 1751 | out_err: |
| 1752 | ubifs_lpt_free(c, 0); | 1752 | if (wr) |
| 1753 | ubifs_lpt_free(c, 1); | ||
| 1754 | if (rd) | ||
| 1755 | ubifs_lpt_free(c, 0); | ||
| 1753 | return err; | 1756 | return err; |
| 1754 | } | 1757 | } |
| 1755 | 1758 | ||
diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c index c30d976b4be8..edeec499c048 100644 --- a/fs/ubifs/recovery.c +++ b/fs/ubifs/recovery.c | |||
| @@ -788,7 +788,7 @@ struct ubifs_scan_leb *ubifs_recover_leb(struct ubifs_info *c, int lnum, | |||
| 788 | 788 | ||
| 789 | corrupted_rescan: | 789 | corrupted_rescan: |
| 790 | /* Re-scan the corrupted data with verbose messages */ | 790 | /* Re-scan the corrupted data with verbose messages */ |
| 791 | ubifs_err("corruptio %d", ret); | 791 | ubifs_err("corruption %d", ret); |
| 792 | ubifs_scan_a_node(c, buf, len, lnum, offs, 1); | 792 | ubifs_scan_a_node(c, buf, len, lnum, offs, 1); |
| 793 | corrupted: | 793 | corrupted: |
| 794 | ubifs_scanned_corruption(c, lnum, offs, buf); | 794 | ubifs_scanned_corruption(c, lnum, offs, buf); |
diff --git a/fs/ubifs/replay.c b/fs/ubifs/replay.c index eba46d4a7619..94d78fc5d4e0 100644 --- a/fs/ubifs/replay.c +++ b/fs/ubifs/replay.c | |||
| @@ -1026,7 +1026,6 @@ int ubifs_replay_journal(struct ubifs_info *c) | |||
| 1026 | c->replaying = 1; | 1026 | c->replaying = 1; |
| 1027 | lnum = c->ltail_lnum = c->lhead_lnum; | 1027 | lnum = c->ltail_lnum = c->lhead_lnum; |
| 1028 | 1028 | ||
| 1029 | lnum = UBIFS_LOG_LNUM; | ||
| 1030 | do { | 1029 | do { |
| 1031 | err = replay_log_leb(c, lnum, 0, c->sbuf); | 1030 | err = replay_log_leb(c, lnum, 0, c->sbuf); |
| 1032 | if (err == 1) | 1031 | if (err == 1) |
| @@ -1035,7 +1034,7 @@ int ubifs_replay_journal(struct ubifs_info *c) | |||
| 1035 | if (err) | 1034 | if (err) |
| 1036 | goto out; | 1035 | goto out; |
| 1037 | lnum = ubifs_next_log_lnum(c, lnum); | 1036 | lnum = ubifs_next_log_lnum(c, lnum); |
| 1038 | } while (lnum != UBIFS_LOG_LNUM); | 1037 | } while (lnum != c->ltail_lnum); |
| 1039 | 1038 | ||
| 1040 | err = replay_buds(c); | 1039 | err = replay_buds(c); |
| 1041 | if (err) | 1040 | if (err) |
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c index c3fa6c5327a3..71a197f0f93d 100644 --- a/fs/ubifs/super.c +++ b/fs/ubifs/super.c | |||
| @@ -1157,9 +1157,6 @@ static int check_free_space(struct ubifs_info *c) | |||
| 1157 | * | 1157 | * |
| 1158 | * This function mounts UBIFS file system. Returns zero in case of success and | 1158 | * This function mounts UBIFS file system. Returns zero in case of success and |
| 1159 | * a negative error code in case of failure. | 1159 | * a negative error code in case of failure. |
| 1160 | * | ||
| 1161 | * Note, the function does not de-allocate resources it it fails half way | ||
| 1162 | * through, and the caller has to do this instead. | ||
| 1163 | */ | 1160 | */ |
| 1164 | static int mount_ubifs(struct ubifs_info *c) | 1161 | static int mount_ubifs(struct ubifs_info *c) |
| 1165 | { | 1162 | { |
diff --git a/fs/udf/inode.c b/fs/udf/inode.c index fafaad795cd6..aa233469b3c1 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c | |||
| @@ -1124,14 +1124,17 @@ int udf_setsize(struct inode *inode, loff_t newsize) | |||
| 1124 | if (err) | 1124 | if (err) |
| 1125 | return err; | 1125 | return err; |
| 1126 | down_write(&iinfo->i_data_sem); | 1126 | down_write(&iinfo->i_data_sem); |
| 1127 | } else | 1127 | } else { |
| 1128 | iinfo->i_lenAlloc = newsize; | 1128 | iinfo->i_lenAlloc = newsize; |
| 1129 | goto set_size; | ||
| 1130 | } | ||
| 1129 | } | 1131 | } |
| 1130 | err = udf_extend_file(inode, newsize); | 1132 | err = udf_extend_file(inode, newsize); |
| 1131 | if (err) { | 1133 | if (err) { |
| 1132 | up_write(&iinfo->i_data_sem); | 1134 | up_write(&iinfo->i_data_sem); |
| 1133 | return err; | 1135 | return err; |
| 1134 | } | 1136 | } |
| 1137 | set_size: | ||
| 1135 | truncate_setsize(inode, newsize); | 1138 | truncate_setsize(inode, newsize); |
| 1136 | up_write(&iinfo->i_data_sem); | 1139 | up_write(&iinfo->i_data_sem); |
| 1137 | } else { | 1140 | } else { |
diff --git a/fs/udf/super.c b/fs/udf/super.c index dcbf98722afc..18fc038a438d 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c | |||
| @@ -1344,6 +1344,7 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block, | |||
| 1344 | udf_err(sb, "error loading logical volume descriptor: " | 1344 | udf_err(sb, "error loading logical volume descriptor: " |
| 1345 | "Partition table too long (%u > %lu)\n", table_len, | 1345 | "Partition table too long (%u > %lu)\n", table_len, |
| 1346 | sb->s_blocksize - sizeof(*lvd)); | 1346 | sb->s_blocksize - sizeof(*lvd)); |
| 1347 | ret = 1; | ||
| 1347 | goto out_bh; | 1348 | goto out_bh; |
| 1348 | } | 1349 | } |
| 1349 | 1350 | ||
| @@ -1388,8 +1389,10 @@ static int udf_load_logicalvol(struct super_block *sb, sector_t block, | |||
| 1388 | UDF_ID_SPARABLE, | 1389 | UDF_ID_SPARABLE, |
| 1389 | strlen(UDF_ID_SPARABLE))) { | 1390 | strlen(UDF_ID_SPARABLE))) { |
| 1390 | if (udf_load_sparable_map(sb, map, | 1391 | if (udf_load_sparable_map(sb, map, |
| 1391 | (struct sparablePartitionMap *)gpm) < 0) | 1392 | (struct sparablePartitionMap *)gpm) < 0) { |
| 1393 | ret = 1; | ||
| 1392 | goto out_bh; | 1394 | goto out_bh; |
| 1395 | } | ||
| 1393 | } else if (!strncmp(upm2->partIdent.ident, | 1396 | } else if (!strncmp(upm2->partIdent.ident, |
| 1394 | UDF_ID_METADATA, | 1397 | UDF_ID_METADATA, |
| 1395 | strlen(UDF_ID_METADATA))) { | 1398 | strlen(UDF_ID_METADATA))) { |
| @@ -2000,6 +2003,8 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) | |||
| 2000 | if (!silent) | 2003 | if (!silent) |
| 2001 | pr_notice("Rescanning with blocksize %d\n", | 2004 | pr_notice("Rescanning with blocksize %d\n", |
| 2002 | UDF_DEFAULT_BLOCKSIZE); | 2005 | UDF_DEFAULT_BLOCKSIZE); |
| 2006 | brelse(sbi->s_lvid_bh); | ||
| 2007 | sbi->s_lvid_bh = NULL; | ||
| 2003 | uopt.blocksize = UDF_DEFAULT_BLOCKSIZE; | 2008 | uopt.blocksize = UDF_DEFAULT_BLOCKSIZE; |
| 2004 | ret = udf_load_vrs(sb, &uopt, silent, &fileset); | 2009 | ret = udf_load_vrs(sb, &uopt, silent, &fileset); |
| 2005 | } | 2010 | } |
diff --git a/fs/xfs/xfs_discard.c b/fs/xfs/xfs_discard.c index f9c3fe304a17..69cf4fcde03e 100644 --- a/fs/xfs/xfs_discard.c +++ b/fs/xfs/xfs_discard.c | |||
| @@ -179,12 +179,14 @@ xfs_ioc_trim( | |||
| 179 | * used by the fstrim application. In the end it really doesn't | 179 | * used by the fstrim application. In the end it really doesn't |
| 180 | * matter as trimming blocks is an advisory interface. | 180 | * matter as trimming blocks is an advisory interface. |
| 181 | */ | 181 | */ |
| 182 | if (range.start >= XFS_FSB_TO_B(mp, mp->m_sb.sb_dblocks) || | ||
| 183 | range.minlen > XFS_FSB_TO_B(mp, XFS_ALLOC_AG_MAX_USABLE(mp))) | ||
| 184 | return -XFS_ERROR(EINVAL); | ||
| 185 | |||
| 182 | start = BTOBB(range.start); | 186 | start = BTOBB(range.start); |
| 183 | end = start + BTOBBT(range.len) - 1; | 187 | end = start + BTOBBT(range.len) - 1; |
| 184 | minlen = BTOBB(max_t(u64, granularity, range.minlen)); | 188 | minlen = BTOBB(max_t(u64, granularity, range.minlen)); |
| 185 | 189 | ||
| 186 | if (XFS_BB_TO_FSB(mp, start) >= mp->m_sb.sb_dblocks) | ||
| 187 | return -XFS_ERROR(EINVAL); | ||
| 188 | if (end > XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks) - 1) | 190 | if (end > XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks) - 1) |
| 189 | end = XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks)- 1; | 191 | end = XFS_FSB_TO_BB(mp, mp->m_sb.sb_dblocks)- 1; |
| 190 | 192 | ||
diff --git a/fs/xfs/xfs_ialloc.c b/fs/xfs/xfs_ialloc.c index 21e37b55f7e5..5aceb3f8ecd6 100644 --- a/fs/xfs/xfs_ialloc.c +++ b/fs/xfs/xfs_ialloc.c | |||
| @@ -962,23 +962,22 @@ xfs_dialloc( | |||
| 962 | if (!pag->pagi_freecount && !okalloc) | 962 | if (!pag->pagi_freecount && !okalloc) |
| 963 | goto nextag; | 963 | goto nextag; |
| 964 | 964 | ||
| 965 | /* | ||
| 966 | * Then read in the AGI buffer and recheck with the AGI buffer | ||
| 967 | * lock held. | ||
| 968 | */ | ||
| 965 | error = xfs_ialloc_read_agi(mp, tp, agno, &agbp); | 969 | error = xfs_ialloc_read_agi(mp, tp, agno, &agbp); |
| 966 | if (error) | 970 | if (error) |
| 967 | goto out_error; | 971 | goto out_error; |
| 968 | 972 | ||
| 969 | /* | ||
| 970 | * Once the AGI has been read in we have to recheck | ||
| 971 | * pagi_freecount with the AGI buffer lock held. | ||
| 972 | */ | ||
| 973 | if (pag->pagi_freecount) { | 973 | if (pag->pagi_freecount) { |
| 974 | xfs_perag_put(pag); | 974 | xfs_perag_put(pag); |
| 975 | goto out_alloc; | 975 | goto out_alloc; |
| 976 | } | 976 | } |
| 977 | 977 | ||
| 978 | if (!okalloc) { | 978 | if (!okalloc) |
| 979 | xfs_trans_brelse(tp, agbp); | 979 | goto nextag_relse_buffer; |
| 980 | goto nextag; | 980 | |
| 981 | } | ||
| 982 | 981 | ||
| 983 | error = xfs_ialloc_ag_alloc(tp, agbp, &ialloced); | 982 | error = xfs_ialloc_ag_alloc(tp, agbp, &ialloced); |
| 984 | if (error) { | 983 | if (error) { |
| @@ -1007,6 +1006,8 @@ xfs_dialloc( | |||
| 1007 | return 0; | 1006 | return 0; |
| 1008 | } | 1007 | } |
| 1009 | 1008 | ||
| 1009 | nextag_relse_buffer: | ||
| 1010 | xfs_trans_brelse(tp, agbp); | ||
| 1010 | nextag: | 1011 | nextag: |
| 1011 | xfs_perag_put(pag); | 1012 | xfs_perag_put(pag); |
| 1012 | if (++agno == mp->m_sb.sb_agcount) | 1013 | if (++agno == mp->m_sb.sb_agcount) |
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c index 92d4331cd4f1..ca28a4ba4b54 100644 --- a/fs/xfs/xfs_rtalloc.c +++ b/fs/xfs/xfs_rtalloc.c | |||
| @@ -857,7 +857,7 @@ xfs_rtbuf_get( | |||
| 857 | xfs_buf_t *bp; /* block buffer, result */ | 857 | xfs_buf_t *bp; /* block buffer, result */ |
| 858 | xfs_inode_t *ip; /* bitmap or summary inode */ | 858 | xfs_inode_t *ip; /* bitmap or summary inode */ |
| 859 | xfs_bmbt_irec_t map; | 859 | xfs_bmbt_irec_t map; |
| 860 | int nmap; | 860 | int nmap = 1; |
| 861 | int error; /* error value */ | 861 | int error; /* error value */ |
| 862 | 862 | ||
| 863 | ip = issum ? mp->m_rsumip : mp->m_rbmip; | 863 | ip = issum ? mp->m_rsumip : mp->m_rbmip; |
