diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/binfmt_flat.c | 46 | ||||
-rw-r--r-- | fs/btrfs/extent-tree.c | 51 | ||||
-rw-r--r-- | fs/btrfs/volumes.c | 1 | ||||
-rw-r--r-- | fs/buffer.c | 2 | ||||
-rw-r--r-- | fs/cachefiles/internal.h | 18 | ||||
-rw-r--r-- | fs/cifs/dir.c | 51 | ||||
-rw-r--r-- | fs/cifs/file.c | 66 | ||||
-rw-r--r-- | fs/fscache/internal.h | 18 | ||||
-rw-r--r-- | fs/inode.c | 32 | ||||
-rw-r--r-- | fs/jffs2/erase.c | 7 | ||||
-rw-r--r-- | fs/nfs/nfs4proc.c | 9 | ||||
-rw-r--r-- | fs/nfs/nfsroot.c | 2 | ||||
-rw-r--r-- | fs/nfsd/vfs.c | 6 | ||||
-rw-r--r-- | fs/nilfs2/cpfile.c | 6 | ||||
-rw-r--r-- | fs/nilfs2/ioctl.c | 2 | ||||
-rw-r--r-- | fs/proc/base.c | 2 | ||||
-rw-r--r-- | fs/sysfs/file.c | 2 | ||||
-rw-r--r-- | fs/xfs/linux-2.6/kmem.h | 2 | ||||
-rw-r--r-- | fs/xfs/xfs_dfrag.c | 8 | ||||
-rw-r--r-- | fs/xfs/xfs_fsops.c | 2 |
20 files changed, 212 insertions, 121 deletions
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c index 5cebf0b37798..697f6b5f1313 100644 --- a/fs/binfmt_flat.c +++ b/fs/binfmt_flat.c | |||
@@ -41,6 +41,7 @@ | |||
41 | #include <asm/uaccess.h> | 41 | #include <asm/uaccess.h> |
42 | #include <asm/unaligned.h> | 42 | #include <asm/unaligned.h> |
43 | #include <asm/cacheflush.h> | 43 | #include <asm/cacheflush.h> |
44 | #include <asm/page.h> | ||
44 | 45 | ||
45 | /****************************************************************************/ | 46 | /****************************************************************************/ |
46 | 47 | ||
@@ -54,6 +55,18 @@ | |||
54 | #define DBG_FLT(a...) | 55 | #define DBG_FLT(a...) |
55 | #endif | 56 | #endif |
56 | 57 | ||
58 | /* | ||
59 | * User data (stack, data section and bss) needs to be aligned | ||
60 | * for the same reasons as SLAB memory is, and to the same amount. | ||
61 | * Avoid duplicating architecture specific code by using the same | ||
62 | * macro as with SLAB allocation: | ||
63 | */ | ||
64 | #ifdef ARCH_SLAB_MINALIGN | ||
65 | #define FLAT_DATA_ALIGN (ARCH_SLAB_MINALIGN) | ||
66 | #else | ||
67 | #define FLAT_DATA_ALIGN (sizeof(void *)) | ||
68 | #endif | ||
69 | |||
57 | #define RELOC_FAILED 0xff00ff01 /* Relocation incorrect somewhere */ | 70 | #define RELOC_FAILED 0xff00ff01 /* Relocation incorrect somewhere */ |
58 | #define UNLOADED_LIB 0x7ff000ff /* Placeholder for unused library */ | 71 | #define UNLOADED_LIB 0x7ff000ff /* Placeholder for unused library */ |
59 | 72 | ||
@@ -114,20 +127,18 @@ static unsigned long create_flat_tables( | |||
114 | int envc = bprm->envc; | 127 | int envc = bprm->envc; |
115 | char uninitialized_var(dummy); | 128 | char uninitialized_var(dummy); |
116 | 129 | ||
117 | sp = (unsigned long *) ((-(unsigned long)sizeof(char *))&(unsigned long) p); | 130 | sp = (unsigned long *)p; |
131 | sp -= (envc + argc + 2) + 1 + (flat_argvp_envp_on_stack() ? 2 : 0); | ||
132 | sp = (unsigned long *) ((unsigned long)sp & -FLAT_DATA_ALIGN); | ||
133 | argv = sp + 1 + (flat_argvp_envp_on_stack() ? 2 : 0); | ||
134 | envp = argv + (argc + 1); | ||
118 | 135 | ||
119 | sp -= envc+1; | ||
120 | envp = sp; | ||
121 | sp -= argc+1; | ||
122 | argv = sp; | ||
123 | |||
124 | flat_stack_align(sp); | ||
125 | if (flat_argvp_envp_on_stack()) { | 136 | if (flat_argvp_envp_on_stack()) { |
126 | --sp; put_user((unsigned long) envp, sp); | 137 | put_user((unsigned long) envp, sp + 2); |
127 | --sp; put_user((unsigned long) argv, sp); | 138 | put_user((unsigned long) argv, sp + 1); |
128 | } | 139 | } |
129 | 140 | ||
130 | put_user(argc,--sp); | 141 | put_user(argc, sp); |
131 | current->mm->arg_start = (unsigned long) p; | 142 | current->mm->arg_start = (unsigned long) p; |
132 | while (argc-->0) { | 143 | while (argc-->0) { |
133 | put_user((unsigned long) p, argv++); | 144 | put_user((unsigned long) p, argv++); |
@@ -558,7 +569,9 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
558 | ret = realdatastart; | 569 | ret = realdatastart; |
559 | goto err; | 570 | goto err; |
560 | } | 571 | } |
561 | datapos = realdatastart + MAX_SHARED_LIBS * sizeof(unsigned long); | 572 | datapos = ALIGN(realdatastart + |
573 | MAX_SHARED_LIBS * sizeof(unsigned long), | ||
574 | FLAT_DATA_ALIGN); | ||
562 | 575 | ||
563 | DBG_FLT("BINFMT_FLAT: Allocated data+bss+stack (%d bytes): %x\n", | 576 | DBG_FLT("BINFMT_FLAT: Allocated data+bss+stack (%d bytes): %x\n", |
564 | (int)(data_len + bss_len + stack_len), (int)datapos); | 577 | (int)(data_len + bss_len + stack_len), (int)datapos); |
@@ -604,9 +617,12 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
604 | } | 617 | } |
605 | 618 | ||
606 | realdatastart = textpos + ntohl(hdr->data_start); | 619 | realdatastart = textpos + ntohl(hdr->data_start); |
607 | datapos = realdatastart + MAX_SHARED_LIBS * sizeof(unsigned long); | 620 | datapos = ALIGN(realdatastart + |
608 | reloc = (unsigned long *) (textpos + ntohl(hdr->reloc_start) + | 621 | MAX_SHARED_LIBS * sizeof(unsigned long), |
609 | MAX_SHARED_LIBS * sizeof(unsigned long)); | 622 | FLAT_DATA_ALIGN); |
623 | |||
624 | reloc = (unsigned long *) | ||
625 | (datapos + (ntohl(hdr->reloc_start) - text_len)); | ||
610 | memp = textpos; | 626 | memp = textpos; |
611 | memp_size = len; | 627 | memp_size = len; |
612 | #ifdef CONFIG_BINFMT_ZFLAT | 628 | #ifdef CONFIG_BINFMT_ZFLAT |
@@ -854,7 +870,7 @@ static int load_flat_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
854 | stack_len = TOP_OF_ARGS - bprm->p; /* the strings */ | 870 | stack_len = TOP_OF_ARGS - bprm->p; /* the strings */ |
855 | stack_len += (bprm->argc + 1) * sizeof(char *); /* the argv array */ | 871 | stack_len += (bprm->argc + 1) * sizeof(char *); /* the argv array */ |
856 | stack_len += (bprm->envc + 1) * sizeof(char *); /* the envp array */ | 872 | stack_len += (bprm->envc + 1) * sizeof(char *); /* the envp array */ |
857 | 873 | stack_len += FLAT_DATA_ALIGN - 1; /* reserve for upcoming alignment */ | |
858 | 874 | ||
859 | res = load_flat_file(bprm, &libinfo, 0, &stack_len); | 875 | res = load_flat_file(bprm, &libinfo, 0, &stack_len); |
860 | if (res > (unsigned long)-4096) | 876 | if (res > (unsigned long)-4096) |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 3e2c7c738f23..35af93355063 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c | |||
@@ -2622,7 +2622,18 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans, | |||
2622 | search_start); | 2622 | search_start); |
2623 | if (block_group && block_group_bits(block_group, data)) { | 2623 | if (block_group && block_group_bits(block_group, data)) { |
2624 | down_read(&space_info->groups_sem); | 2624 | down_read(&space_info->groups_sem); |
2625 | goto have_block_group; | 2625 | if (list_empty(&block_group->list) || |
2626 | block_group->ro) { | ||
2627 | /* | ||
2628 | * someone is removing this block group, | ||
2629 | * we can't jump into the have_block_group | ||
2630 | * target because our list pointers are not | ||
2631 | * valid | ||
2632 | */ | ||
2633 | btrfs_put_block_group(block_group); | ||
2634 | up_read(&space_info->groups_sem); | ||
2635 | } else | ||
2636 | goto have_block_group; | ||
2626 | } else if (block_group) { | 2637 | } else if (block_group) { |
2627 | btrfs_put_block_group(block_group); | 2638 | btrfs_put_block_group(block_group); |
2628 | } | 2639 | } |
@@ -2656,6 +2667,13 @@ have_block_group: | |||
2656 | * people trying to start a new cluster | 2667 | * people trying to start a new cluster |
2657 | */ | 2668 | */ |
2658 | spin_lock(&last_ptr->refill_lock); | 2669 | spin_lock(&last_ptr->refill_lock); |
2670 | if (last_ptr->block_group && | ||
2671 | (last_ptr->block_group->ro || | ||
2672 | !block_group_bits(last_ptr->block_group, data))) { | ||
2673 | offset = 0; | ||
2674 | goto refill_cluster; | ||
2675 | } | ||
2676 | |||
2659 | offset = btrfs_alloc_from_cluster(block_group, last_ptr, | 2677 | offset = btrfs_alloc_from_cluster(block_group, last_ptr, |
2660 | num_bytes, search_start); | 2678 | num_bytes, search_start); |
2661 | if (offset) { | 2679 | if (offset) { |
@@ -2681,10 +2699,17 @@ have_block_group: | |||
2681 | 2699 | ||
2682 | last_ptr_loop = 1; | 2700 | last_ptr_loop = 1; |
2683 | search_start = block_group->key.objectid; | 2701 | search_start = block_group->key.objectid; |
2702 | /* | ||
2703 | * we know this block group is properly | ||
2704 | * in the list because | ||
2705 | * btrfs_remove_block_group, drops the | ||
2706 | * cluster before it removes the block | ||
2707 | * group from the list | ||
2708 | */ | ||
2684 | goto have_block_group; | 2709 | goto have_block_group; |
2685 | } | 2710 | } |
2686 | spin_unlock(&last_ptr->lock); | 2711 | spin_unlock(&last_ptr->lock); |
2687 | 2712 | refill_cluster: | |
2688 | /* | 2713 | /* |
2689 | * this cluster didn't work out, free it and | 2714 | * this cluster didn't work out, free it and |
2690 | * start over | 2715 | * start over |
@@ -5968,6 +5993,7 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans, | |||
5968 | { | 5993 | { |
5969 | struct btrfs_path *path; | 5994 | struct btrfs_path *path; |
5970 | struct btrfs_block_group_cache *block_group; | 5995 | struct btrfs_block_group_cache *block_group; |
5996 | struct btrfs_free_cluster *cluster; | ||
5971 | struct btrfs_key key; | 5997 | struct btrfs_key key; |
5972 | int ret; | 5998 | int ret; |
5973 | 5999 | ||
@@ -5979,6 +6005,21 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans, | |||
5979 | 6005 | ||
5980 | memcpy(&key, &block_group->key, sizeof(key)); | 6006 | memcpy(&key, &block_group->key, sizeof(key)); |
5981 | 6007 | ||
6008 | /* make sure this block group isn't part of an allocation cluster */ | ||
6009 | cluster = &root->fs_info->data_alloc_cluster; | ||
6010 | spin_lock(&cluster->refill_lock); | ||
6011 | btrfs_return_cluster_to_free_space(block_group, cluster); | ||
6012 | spin_unlock(&cluster->refill_lock); | ||
6013 | |||
6014 | /* | ||
6015 | * make sure this block group isn't part of a metadata | ||
6016 | * allocation cluster | ||
6017 | */ | ||
6018 | cluster = &root->fs_info->meta_alloc_cluster; | ||
6019 | spin_lock(&cluster->refill_lock); | ||
6020 | btrfs_return_cluster_to_free_space(block_group, cluster); | ||
6021 | spin_unlock(&cluster->refill_lock); | ||
6022 | |||
5982 | path = btrfs_alloc_path(); | 6023 | path = btrfs_alloc_path(); |
5983 | BUG_ON(!path); | 6024 | BUG_ON(!path); |
5984 | 6025 | ||
@@ -5988,7 +6029,11 @@ int btrfs_remove_block_group(struct btrfs_trans_handle *trans, | |||
5988 | spin_unlock(&root->fs_info->block_group_cache_lock); | 6029 | spin_unlock(&root->fs_info->block_group_cache_lock); |
5989 | btrfs_remove_free_space_cache(block_group); | 6030 | btrfs_remove_free_space_cache(block_group); |
5990 | down_write(&block_group->space_info->groups_sem); | 6031 | down_write(&block_group->space_info->groups_sem); |
5991 | list_del(&block_group->list); | 6032 | /* |
6033 | * we must use list_del_init so people can check to see if they | ||
6034 | * are still on the list after taking the semaphore | ||
6035 | */ | ||
6036 | list_del_init(&block_group->list); | ||
5992 | up_write(&block_group->space_info->groups_sem); | 6037 | up_write(&block_group->space_info->groups_sem); |
5993 | 6038 | ||
5994 | spin_lock(&block_group->space_info->lock); | 6039 | spin_lock(&block_group->space_info->lock); |
diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c index 5f01dad4b696..a6d35b0054ca 100644 --- a/fs/btrfs/volumes.c +++ b/fs/btrfs/volumes.c | |||
@@ -1440,6 +1440,7 @@ int btrfs_init_new_device(struct btrfs_root *root, char *device_path) | |||
1440 | device->io_align = root->sectorsize; | 1440 | device->io_align = root->sectorsize; |
1441 | device->sector_size = root->sectorsize; | 1441 | device->sector_size = root->sectorsize; |
1442 | device->total_bytes = i_size_read(bdev->bd_inode); | 1442 | device->total_bytes = i_size_read(bdev->bd_inode); |
1443 | device->disk_total_bytes = device->total_bytes; | ||
1443 | device->dev_root = root->fs_info->dev_root; | 1444 | device->dev_root = root->fs_info->dev_root; |
1444 | device->bdev = bdev; | 1445 | device->bdev = bdev; |
1445 | device->in_fs_metadata = 1; | 1446 | device->in_fs_metadata = 1; |
diff --git a/fs/buffer.c b/fs/buffer.c index aed297739eb0..49106127a4aa 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -2736,6 +2736,8 @@ has_buffers: | |||
2736 | pos += blocksize; | 2736 | pos += blocksize; |
2737 | } | 2737 | } |
2738 | 2738 | ||
2739 | map_bh.b_size = blocksize; | ||
2740 | map_bh.b_state = 0; | ||
2739 | err = get_block(inode, iblock, &map_bh, 0); | 2741 | err = get_block(inode, iblock, &map_bh, 0); |
2740 | if (err) | 2742 | if (err) |
2741 | goto unlock; | 2743 | goto unlock; |
diff --git a/fs/cachefiles/internal.h b/fs/cachefiles/internal.h index 19218e1463d6..f7c255f9c624 100644 --- a/fs/cachefiles/internal.h +++ b/fs/cachefiles/internal.h | |||
@@ -122,13 +122,13 @@ static inline void cachefiles_state_changed(struct cachefiles_cache *cache) | |||
122 | } | 122 | } |
123 | 123 | ||
124 | /* | 124 | /* |
125 | * cf-bind.c | 125 | * bind.c |
126 | */ | 126 | */ |
127 | extern int cachefiles_daemon_bind(struct cachefiles_cache *cache, char *args); | 127 | extern int cachefiles_daemon_bind(struct cachefiles_cache *cache, char *args); |
128 | extern void cachefiles_daemon_unbind(struct cachefiles_cache *cache); | 128 | extern void cachefiles_daemon_unbind(struct cachefiles_cache *cache); |
129 | 129 | ||
130 | /* | 130 | /* |
131 | * cf-daemon.c | 131 | * daemon.c |
132 | */ | 132 | */ |
133 | extern const struct file_operations cachefiles_daemon_fops; | 133 | extern const struct file_operations cachefiles_daemon_fops; |
134 | 134 | ||
@@ -136,17 +136,17 @@ extern int cachefiles_has_space(struct cachefiles_cache *cache, | |||
136 | unsigned fnr, unsigned bnr); | 136 | unsigned fnr, unsigned bnr); |
137 | 137 | ||
138 | /* | 138 | /* |
139 | * cf-interface.c | 139 | * interface.c |
140 | */ | 140 | */ |
141 | extern const struct fscache_cache_ops cachefiles_cache_ops; | 141 | extern const struct fscache_cache_ops cachefiles_cache_ops; |
142 | 142 | ||
143 | /* | 143 | /* |
144 | * cf-key.c | 144 | * key.c |
145 | */ | 145 | */ |
146 | extern char *cachefiles_cook_key(const u8 *raw, int keylen, uint8_t type); | 146 | extern char *cachefiles_cook_key(const u8 *raw, int keylen, uint8_t type); |
147 | 147 | ||
148 | /* | 148 | /* |
149 | * cf-namei.c | 149 | * namei.c |
150 | */ | 150 | */ |
151 | extern int cachefiles_delete_object(struct cachefiles_cache *cache, | 151 | extern int cachefiles_delete_object(struct cachefiles_cache *cache, |
152 | struct cachefiles_object *object); | 152 | struct cachefiles_object *object); |
@@ -165,7 +165,7 @@ extern int cachefiles_check_in_use(struct cachefiles_cache *cache, | |||
165 | struct dentry *dir, char *filename); | 165 | struct dentry *dir, char *filename); |
166 | 166 | ||
167 | /* | 167 | /* |
168 | * cf-proc.c | 168 | * proc.c |
169 | */ | 169 | */ |
170 | #ifdef CONFIG_CACHEFILES_HISTOGRAM | 170 | #ifdef CONFIG_CACHEFILES_HISTOGRAM |
171 | extern atomic_t cachefiles_lookup_histogram[HZ]; | 171 | extern atomic_t cachefiles_lookup_histogram[HZ]; |
@@ -190,7 +190,7 @@ void cachefiles_hist(atomic_t histogram[], unsigned long start_jif) | |||
190 | #endif | 190 | #endif |
191 | 191 | ||
192 | /* | 192 | /* |
193 | * cf-rdwr.c | 193 | * rdwr.c |
194 | */ | 194 | */ |
195 | extern int cachefiles_read_or_alloc_page(struct fscache_retrieval *, | 195 | extern int cachefiles_read_or_alloc_page(struct fscache_retrieval *, |
196 | struct page *, gfp_t); | 196 | struct page *, gfp_t); |
@@ -205,7 +205,7 @@ extern int cachefiles_write_page(struct fscache_storage *, struct page *); | |||
205 | extern void cachefiles_uncache_page(struct fscache_object *, struct page *); | 205 | extern void cachefiles_uncache_page(struct fscache_object *, struct page *); |
206 | 206 | ||
207 | /* | 207 | /* |
208 | * cf-security.c | 208 | * security.c |
209 | */ | 209 | */ |
210 | extern int cachefiles_get_security_ID(struct cachefiles_cache *cache); | 210 | extern int cachefiles_get_security_ID(struct cachefiles_cache *cache); |
211 | extern int cachefiles_determine_cache_security(struct cachefiles_cache *cache, | 211 | extern int cachefiles_determine_cache_security(struct cachefiles_cache *cache, |
@@ -225,7 +225,7 @@ static inline void cachefiles_end_secure(struct cachefiles_cache *cache, | |||
225 | } | 225 | } |
226 | 226 | ||
227 | /* | 227 | /* |
228 | * cf-xattr.c | 228 | * xattr.c |
229 | */ | 229 | */ |
230 | extern int cachefiles_check_object_type(struct cachefiles_object *object); | 230 | extern int cachefiles_check_object_type(struct cachefiles_object *object); |
231 | extern int cachefiles_set_object_xattr(struct cachefiles_object *object, | 231 | extern int cachefiles_set_object_xattr(struct cachefiles_object *object, |
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 11431ed72a7f..3758965d73d5 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
@@ -225,6 +225,7 @@ int cifs_posix_open(char *full_path, struct inode **pinode, | |||
225 | if (!(oflags & FMODE_READ)) | 225 | if (!(oflags & FMODE_READ)) |
226 | write_only = true; | 226 | write_only = true; |
227 | 227 | ||
228 | mode &= ~current_umask(); | ||
228 | rc = CIFSPOSIXCreate(xid, cifs_sb->tcon, posix_flags, mode, | 229 | rc = CIFSPOSIXCreate(xid, cifs_sb->tcon, posix_flags, mode, |
229 | pnetfid, presp_data, &oplock, full_path, | 230 | pnetfid, presp_data, &oplock, full_path, |
230 | cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & | 231 | cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & |
@@ -310,7 +311,6 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, | |||
310 | return -ENOMEM; | 311 | return -ENOMEM; |
311 | } | 312 | } |
312 | 313 | ||
313 | mode &= ~current_umask(); | ||
314 | if (oplockEnabled) | 314 | if (oplockEnabled) |
315 | oplock = REQ_OPLOCK; | 315 | oplock = REQ_OPLOCK; |
316 | 316 | ||
@@ -336,7 +336,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, | |||
336 | else /* success, no need to query */ | 336 | else /* success, no need to query */ |
337 | goto cifs_create_set_dentry; | 337 | goto cifs_create_set_dentry; |
338 | } else if ((rc != -EIO) && (rc != -EREMOTE) && | 338 | } else if ((rc != -EIO) && (rc != -EREMOTE) && |
339 | (rc != -EOPNOTSUPP)) /* path not found or net err */ | 339 | (rc != -EOPNOTSUPP) && (rc != -EINVAL)) |
340 | goto cifs_create_out; | 340 | goto cifs_create_out; |
341 | /* else fallthrough to retry, using older open call, this is | 341 | /* else fallthrough to retry, using older open call, this is |
342 | case where server does not support this SMB level, and | 342 | case where server does not support this SMB level, and |
@@ -609,7 +609,6 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, | |||
609 | int xid; | 609 | int xid; |
610 | int rc = 0; /* to get around spurious gcc warning, set to zero here */ | 610 | int rc = 0; /* to get around spurious gcc warning, set to zero here */ |
611 | int oplock = 0; | 611 | int oplock = 0; |
612 | int mode; | ||
613 | __u16 fileHandle = 0; | 612 | __u16 fileHandle = 0; |
614 | bool posix_open = false; | 613 | bool posix_open = false; |
615 | struct cifs_sb_info *cifs_sb; | 614 | struct cifs_sb_info *cifs_sb; |
@@ -658,30 +657,36 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, | |||
658 | } | 657 | } |
659 | cFYI(1, ("Full path: %s inode = 0x%p", full_path, direntry->d_inode)); | 658 | cFYI(1, ("Full path: %s inode = 0x%p", full_path, direntry->d_inode)); |
660 | 659 | ||
660 | /* Posix open is only called (at lookup time) for file create now. | ||
661 | * For opens (rather than creates), because we do not know if it | ||
662 | * is a file or directory yet, and current Samba no longer allows | ||
663 | * us to do posix open on dirs, we could end up wasting an open call | ||
664 | * on what turns out to be a dir. For file opens, we wait to call posix | ||
665 | * open till cifs_open. It could be added here (lookup) in the future | ||
666 | * but the performance tradeoff of the extra network request when EISDIR | ||
667 | * or EACCES is returned would have to be weighed against the 50% | ||
668 | * reduction in network traffic in the other paths. | ||
669 | */ | ||
661 | if (pTcon->unix_ext) { | 670 | if (pTcon->unix_ext) { |
662 | if (!(nd->flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY)) && | 671 | if (!(nd->flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY)) && |
663 | (nd->flags & LOOKUP_OPEN)) { | 672 | (nd->flags & LOOKUP_OPEN) && !pTcon->broken_posix_open && |
664 | if (!((nd->intent.open.flags & O_CREAT) && | 673 | (nd->intent.open.flags & O_CREAT)) { |
665 | (nd->intent.open.flags & O_EXCL))) { | 674 | rc = cifs_posix_open(full_path, &newInode, |
666 | mode = nd->intent.open.create_mode & | 675 | parent_dir_inode->i_sb, |
667 | ~current_umask(); | 676 | nd->intent.open.create_mode, |
668 | rc = cifs_posix_open(full_path, &newInode, | ||
669 | parent_dir_inode->i_sb, mode, | ||
670 | nd->intent.open.flags, &oplock, | 677 | nd->intent.open.flags, &oplock, |
671 | &fileHandle, xid); | 678 | &fileHandle, xid); |
672 | /* | 679 | /* |
673 | * This code works around a bug in | 680 | * The check below works around a bug in POSIX |
674 | * samba posix open in samba versions 3.3.1 | 681 | * open in samba versions 3.3.1 and earlier where |
675 | * and earlier where create works | 682 | * open could incorrectly fail with invalid parameter. |
676 | * but open fails with invalid parameter. | 683 | * If either that or op not supported returned, follow |
677 | * If either of these error codes are | 684 | * the normal lookup. |
678 | * returned, follow the normal lookup. | 685 | */ |
679 | * Otherwise, the error during posix open | 686 | if ((rc == 0) || (rc == -ENOENT)) |
680 | * is handled. | 687 | posix_open = true; |
681 | */ | 688 | else if ((rc == -EINVAL) || (rc != -EOPNOTSUPP)) |
682 | if ((rc != -EINVAL) && (rc != -EOPNOTSUPP)) | 689 | pTcon->broken_posix_open = true; |
683 | posix_open = true; | ||
684 | } | ||
685 | } | 690 | } |
686 | if (!posix_open) | 691 | if (!posix_open) |
687 | rc = cifs_get_inode_info_unix(&newInode, full_path, | 692 | rc = cifs_get_inode_info_unix(&newInode, full_path, |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 38c06f826575..302ea15f02e6 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -130,10 +130,6 @@ static inline int cifs_posix_open_inode_helper(struct inode *inode, | |||
130 | struct cifsFileInfo *pCifsFile, int oplock, u16 netfid) | 130 | struct cifsFileInfo *pCifsFile, int oplock, u16 netfid) |
131 | { | 131 | { |
132 | 132 | ||
133 | file->private_data = kmalloc(sizeof(struct cifsFileInfo), GFP_KERNEL); | ||
134 | if (file->private_data == NULL) | ||
135 | return -ENOMEM; | ||
136 | pCifsFile = cifs_init_private(file->private_data, inode, file, netfid); | ||
137 | write_lock(&GlobalSMBSeslock); | 133 | write_lock(&GlobalSMBSeslock); |
138 | 134 | ||
139 | pCifsInode = CIFS_I(file->f_path.dentry->d_inode); | 135 | pCifsInode = CIFS_I(file->f_path.dentry->d_inode); |
@@ -184,6 +180,38 @@ psx_client_can_cache: | |||
184 | return 0; | 180 | return 0; |
185 | } | 181 | } |
186 | 182 | ||
183 | static struct cifsFileInfo * | ||
184 | cifs_fill_filedata(struct file *file) | ||
185 | { | ||
186 | struct list_head *tmp; | ||
187 | struct cifsFileInfo *pCifsFile = NULL; | ||
188 | struct cifsInodeInfo *pCifsInode = NULL; | ||
189 | |||
190 | /* search inode for this file and fill in file->private_data */ | ||
191 | pCifsInode = CIFS_I(file->f_path.dentry->d_inode); | ||
192 | read_lock(&GlobalSMBSeslock); | ||
193 | list_for_each(tmp, &pCifsInode->openFileList) { | ||
194 | pCifsFile = list_entry(tmp, struct cifsFileInfo, flist); | ||
195 | if ((pCifsFile->pfile == NULL) && | ||
196 | (pCifsFile->pid == current->tgid)) { | ||
197 | /* mode set in cifs_create */ | ||
198 | |||
199 | /* needed for writepage */ | ||
200 | pCifsFile->pfile = file; | ||
201 | file->private_data = pCifsFile; | ||
202 | break; | ||
203 | } | ||
204 | } | ||
205 | read_unlock(&GlobalSMBSeslock); | ||
206 | |||
207 | if (file->private_data != NULL) { | ||
208 | return pCifsFile; | ||
209 | } else if ((file->f_flags & O_CREAT) && (file->f_flags & O_EXCL)) | ||
210 | cERROR(1, ("could not find file instance for " | ||
211 | "new file %p", file)); | ||
212 | return NULL; | ||
213 | } | ||
214 | |||
187 | /* all arguments to this function must be checked for validity in caller */ | 215 | /* all arguments to this function must be checked for validity in caller */ |
188 | static inline int cifs_open_inode_helper(struct inode *inode, struct file *file, | 216 | static inline int cifs_open_inode_helper(struct inode *inode, struct file *file, |
189 | struct cifsInodeInfo *pCifsInode, struct cifsFileInfo *pCifsFile, | 217 | struct cifsInodeInfo *pCifsInode, struct cifsFileInfo *pCifsFile, |
@@ -258,7 +286,6 @@ int cifs_open(struct inode *inode, struct file *file) | |||
258 | struct cifsTconInfo *tcon; | 286 | struct cifsTconInfo *tcon; |
259 | struct cifsFileInfo *pCifsFile; | 287 | struct cifsFileInfo *pCifsFile; |
260 | struct cifsInodeInfo *pCifsInode; | 288 | struct cifsInodeInfo *pCifsInode; |
261 | struct list_head *tmp; | ||
262 | char *full_path = NULL; | 289 | char *full_path = NULL; |
263 | int desiredAccess; | 290 | int desiredAccess; |
264 | int disposition; | 291 | int disposition; |
@@ -270,32 +297,12 @@ int cifs_open(struct inode *inode, struct file *file) | |||
270 | cifs_sb = CIFS_SB(inode->i_sb); | 297 | cifs_sb = CIFS_SB(inode->i_sb); |
271 | tcon = cifs_sb->tcon; | 298 | tcon = cifs_sb->tcon; |
272 | 299 | ||
273 | /* search inode for this file and fill in file->private_data */ | ||
274 | pCifsInode = CIFS_I(file->f_path.dentry->d_inode); | 300 | pCifsInode = CIFS_I(file->f_path.dentry->d_inode); |
275 | read_lock(&GlobalSMBSeslock); | 301 | pCifsFile = cifs_fill_filedata(file); |
276 | list_for_each(tmp, &pCifsInode->openFileList) { | 302 | if (pCifsFile) { |
277 | pCifsFile = list_entry(tmp, struct cifsFileInfo, | ||
278 | flist); | ||
279 | if ((pCifsFile->pfile == NULL) && | ||
280 | (pCifsFile->pid == current->tgid)) { | ||
281 | /* mode set in cifs_create */ | ||
282 | |||
283 | /* needed for writepage */ | ||
284 | pCifsFile->pfile = file; | ||
285 | |||
286 | file->private_data = pCifsFile; | ||
287 | break; | ||
288 | } | ||
289 | } | ||
290 | read_unlock(&GlobalSMBSeslock); | ||
291 | |||
292 | if (file->private_data != NULL) { | ||
293 | rc = 0; | ||
294 | FreeXid(xid); | 303 | FreeXid(xid); |
295 | return rc; | 304 | return 0; |
296 | } else if ((file->f_flags & O_CREAT) && (file->f_flags & O_EXCL)) | 305 | } |
297 | cERROR(1, ("could not find file instance for " | ||
298 | "new file %p", file)); | ||
299 | 306 | ||
300 | full_path = build_path_from_dentry(file->f_path.dentry); | 307 | full_path = build_path_from_dentry(file->f_path.dentry); |
301 | if (full_path == NULL) { | 308 | if (full_path == NULL) { |
@@ -325,6 +332,7 @@ int cifs_open(struct inode *inode, struct file *file) | |||
325 | /* no need for special case handling of setting mode | 332 | /* no need for special case handling of setting mode |
326 | on read only files needed here */ | 333 | on read only files needed here */ |
327 | 334 | ||
335 | pCifsFile = cifs_fill_filedata(file); | ||
328 | cifs_posix_open_inode_helper(inode, file, pCifsInode, | 336 | cifs_posix_open_inode_helper(inode, file, pCifsInode, |
329 | pCifsFile, oplock, netfid); | 337 | pCifsFile, oplock, netfid); |
330 | goto out; | 338 | goto out; |
diff --git a/fs/fscache/internal.h b/fs/fscache/internal.h index e0cbd16f6dc9..1c341304621f 100644 --- a/fs/fscache/internal.h +++ b/fs/fscache/internal.h | |||
@@ -28,7 +28,7 @@ | |||
28 | #define FSCACHE_MAX_THREADS 32 | 28 | #define FSCACHE_MAX_THREADS 32 |
29 | 29 | ||
30 | /* | 30 | /* |
31 | * fsc-cache.c | 31 | * cache.c |
32 | */ | 32 | */ |
33 | extern struct list_head fscache_cache_list; | 33 | extern struct list_head fscache_cache_list; |
34 | extern struct rw_semaphore fscache_addremove_sem; | 34 | extern struct rw_semaphore fscache_addremove_sem; |
@@ -37,7 +37,7 @@ extern struct fscache_cache *fscache_select_cache_for_object( | |||
37 | struct fscache_cookie *); | 37 | struct fscache_cookie *); |
38 | 38 | ||
39 | /* | 39 | /* |
40 | * fsc-cookie.c | 40 | * cookie.c |
41 | */ | 41 | */ |
42 | extern struct kmem_cache *fscache_cookie_jar; | 42 | extern struct kmem_cache *fscache_cookie_jar; |
43 | 43 | ||
@@ -45,13 +45,13 @@ extern void fscache_cookie_init_once(void *); | |||
45 | extern void __fscache_cookie_put(struct fscache_cookie *); | 45 | extern void __fscache_cookie_put(struct fscache_cookie *); |
46 | 46 | ||
47 | /* | 47 | /* |
48 | * fsc-fsdef.c | 48 | * fsdef.c |
49 | */ | 49 | */ |
50 | extern struct fscache_cookie fscache_fsdef_index; | 50 | extern struct fscache_cookie fscache_fsdef_index; |
51 | extern struct fscache_cookie_def fscache_fsdef_netfs_def; | 51 | extern struct fscache_cookie_def fscache_fsdef_netfs_def; |
52 | 52 | ||
53 | /* | 53 | /* |
54 | * fsc-histogram.c | 54 | * histogram.c |
55 | */ | 55 | */ |
56 | #ifdef CONFIG_FSCACHE_HISTOGRAM | 56 | #ifdef CONFIG_FSCACHE_HISTOGRAM |
57 | extern atomic_t fscache_obj_instantiate_histogram[HZ]; | 57 | extern atomic_t fscache_obj_instantiate_histogram[HZ]; |
@@ -75,7 +75,7 @@ extern const struct file_operations fscache_histogram_fops; | |||
75 | #endif | 75 | #endif |
76 | 76 | ||
77 | /* | 77 | /* |
78 | * fsc-main.c | 78 | * main.c |
79 | */ | 79 | */ |
80 | extern unsigned fscache_defer_lookup; | 80 | extern unsigned fscache_defer_lookup; |
81 | extern unsigned fscache_defer_create; | 81 | extern unsigned fscache_defer_create; |
@@ -86,14 +86,14 @@ extern int fscache_wait_bit(void *); | |||
86 | extern int fscache_wait_bit_interruptible(void *); | 86 | extern int fscache_wait_bit_interruptible(void *); |
87 | 87 | ||
88 | /* | 88 | /* |
89 | * fsc-object.c | 89 | * object.c |
90 | */ | 90 | */ |
91 | extern void fscache_withdrawing_object(struct fscache_cache *, | 91 | extern void fscache_withdrawing_object(struct fscache_cache *, |
92 | struct fscache_object *); | 92 | struct fscache_object *); |
93 | extern void fscache_enqueue_object(struct fscache_object *); | 93 | extern void fscache_enqueue_object(struct fscache_object *); |
94 | 94 | ||
95 | /* | 95 | /* |
96 | * fsc-operation.c | 96 | * operation.c |
97 | */ | 97 | */ |
98 | extern int fscache_submit_exclusive_op(struct fscache_object *, | 98 | extern int fscache_submit_exclusive_op(struct fscache_object *, |
99 | struct fscache_operation *); | 99 | struct fscache_operation *); |
@@ -104,7 +104,7 @@ extern void fscache_start_operations(struct fscache_object *); | |||
104 | extern void fscache_operation_gc(struct work_struct *); | 104 | extern void fscache_operation_gc(struct work_struct *); |
105 | 105 | ||
106 | /* | 106 | /* |
107 | * fsc-proc.c | 107 | * proc.c |
108 | */ | 108 | */ |
109 | #ifdef CONFIG_PROC_FS | 109 | #ifdef CONFIG_PROC_FS |
110 | extern int __init fscache_proc_init(void); | 110 | extern int __init fscache_proc_init(void); |
@@ -115,7 +115,7 @@ extern void fscache_proc_cleanup(void); | |||
115 | #endif | 115 | #endif |
116 | 116 | ||
117 | /* | 117 | /* |
118 | * fsc-stats.c | 118 | * stats.c |
119 | */ | 119 | */ |
120 | #ifdef CONFIG_FSCACHE_STATS | 120 | #ifdef CONFIG_FSCACHE_STATS |
121 | extern atomic_t fscache_n_ops_processed[FSCACHE_MAX_THREADS]; | 121 | extern atomic_t fscache_n_ops_processed[FSCACHE_MAX_THREADS]; |
diff --git a/fs/inode.c b/fs/inode.c index 0571983755dc..bca0c618fdb3 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -219,6 +219,7 @@ static struct inode *alloc_inode(struct super_block *sb) | |||
219 | void destroy_inode(struct inode *inode) | 219 | void destroy_inode(struct inode *inode) |
220 | { | 220 | { |
221 | BUG_ON(inode_has_buffers(inode)); | 221 | BUG_ON(inode_has_buffers(inode)); |
222 | ima_inode_free(inode); | ||
222 | security_inode_free(inode); | 223 | security_inode_free(inode); |
223 | if (inode->i_sb->s_op->destroy_inode) | 224 | if (inode->i_sb->s_op->destroy_inode) |
224 | inode->i_sb->s_op->destroy_inode(inode); | 225 | inode->i_sb->s_op->destroy_inode(inode); |
@@ -1053,13 +1054,22 @@ int insert_inode_locked(struct inode *inode) | |||
1053 | struct super_block *sb = inode->i_sb; | 1054 | struct super_block *sb = inode->i_sb; |
1054 | ino_t ino = inode->i_ino; | 1055 | ino_t ino = inode->i_ino; |
1055 | struct hlist_head *head = inode_hashtable + hash(sb, ino); | 1056 | struct hlist_head *head = inode_hashtable + hash(sb, ino); |
1056 | struct inode *old; | ||
1057 | 1057 | ||
1058 | inode->i_state |= I_LOCK|I_NEW; | 1058 | inode->i_state |= I_LOCK|I_NEW; |
1059 | while (1) { | 1059 | while (1) { |
1060 | struct hlist_node *node; | ||
1061 | struct inode *old = NULL; | ||
1060 | spin_lock(&inode_lock); | 1062 | spin_lock(&inode_lock); |
1061 | old = find_inode_fast(sb, head, ino); | 1063 | hlist_for_each_entry(old, node, head, i_hash) { |
1062 | if (likely(!old)) { | 1064 | if (old->i_ino != ino) |
1065 | continue; | ||
1066 | if (old->i_sb != sb) | ||
1067 | continue; | ||
1068 | if (old->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE)) | ||
1069 | continue; | ||
1070 | break; | ||
1071 | } | ||
1072 | if (likely(!node)) { | ||
1063 | hlist_add_head(&inode->i_hash, head); | 1073 | hlist_add_head(&inode->i_hash, head); |
1064 | spin_unlock(&inode_lock); | 1074 | spin_unlock(&inode_lock); |
1065 | return 0; | 1075 | return 0; |
@@ -1081,14 +1091,24 @@ int insert_inode_locked4(struct inode *inode, unsigned long hashval, | |||
1081 | { | 1091 | { |
1082 | struct super_block *sb = inode->i_sb; | 1092 | struct super_block *sb = inode->i_sb; |
1083 | struct hlist_head *head = inode_hashtable + hash(sb, hashval); | 1093 | struct hlist_head *head = inode_hashtable + hash(sb, hashval); |
1084 | struct inode *old; | ||
1085 | 1094 | ||
1086 | inode->i_state |= I_LOCK|I_NEW; | 1095 | inode->i_state |= I_LOCK|I_NEW; |
1087 | 1096 | ||
1088 | while (1) { | 1097 | while (1) { |
1098 | struct hlist_node *node; | ||
1099 | struct inode *old = NULL; | ||
1100 | |||
1089 | spin_lock(&inode_lock); | 1101 | spin_lock(&inode_lock); |
1090 | old = find_inode(sb, head, test, data); | 1102 | hlist_for_each_entry(old, node, head, i_hash) { |
1091 | if (likely(!old)) { | 1103 | if (old->i_sb != sb) |
1104 | continue; | ||
1105 | if (!test(old, data)) | ||
1106 | continue; | ||
1107 | if (old->i_state & (I_FREEING|I_CLEAR|I_WILL_FREE)) | ||
1108 | continue; | ||
1109 | break; | ||
1110 | } | ||
1111 | if (likely(!node)) { | ||
1092 | hlist_add_head(&inode->i_hash, head); | 1112 | hlist_add_head(&inode->i_hash, head); |
1093 | spin_unlock(&inode_lock); | 1113 | spin_unlock(&inode_lock); |
1094 | return 0; | 1114 | return 0; |
diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c index c32b4a1ad6cf..a0244740b75a 100644 --- a/fs/jffs2/erase.c +++ b/fs/jffs2/erase.c | |||
@@ -480,13 +480,6 @@ static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseb | |||
480 | return; | 480 | return; |
481 | 481 | ||
482 | filebad: | 482 | filebad: |
483 | mutex_lock(&c->erase_free_sem); | ||
484 | spin_lock(&c->erase_completion_lock); | ||
485 | /* Stick it on a list (any list) so erase_failed can take it | ||
486 | right off again. Silly, but shouldn't happen often. */ | ||
487 | list_move(&jeb->list, &c->erasing_list); | ||
488 | spin_unlock(&c->erase_completion_lock); | ||
489 | mutex_unlock(&c->erase_free_sem); | ||
490 | jffs2_erase_failed(c, jeb, bad_offset); | 483 | jffs2_erase_failed(c, jeb, bad_offset); |
491 | return; | 484 | return; |
492 | 485 | ||
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index a4d242680299..4674f8092da8 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -2594,12 +2594,9 @@ static void nfs4_renew_done(struct rpc_task *task, void *data) | |||
2594 | unsigned long timestamp = (unsigned long)data; | 2594 | unsigned long timestamp = (unsigned long)data; |
2595 | 2595 | ||
2596 | if (task->tk_status < 0) { | 2596 | if (task->tk_status < 0) { |
2597 | switch (task->tk_status) { | 2597 | /* Unless we're shutting down, schedule state recovery! */ |
2598 | case -NFS4ERR_STALE_CLIENTID: | 2598 | if (test_bit(NFS_CS_RENEWD, &clp->cl_res_state) != 0) |
2599 | case -NFS4ERR_EXPIRED: | 2599 | nfs4_schedule_state_recovery(clp); |
2600 | case -NFS4ERR_CB_PATH_DOWN: | ||
2601 | nfs4_schedule_state_recovery(clp); | ||
2602 | } | ||
2603 | return; | 2600 | return; |
2604 | } | 2601 | } |
2605 | spin_lock(&clp->cl_lock); | 2602 | spin_lock(&clp->cl_lock); |
diff --git a/fs/nfs/nfsroot.c b/fs/nfs/nfsroot.c index d9ef602fbc5a..e3ed5908820b 100644 --- a/fs/nfs/nfsroot.c +++ b/fs/nfs/nfsroot.c | |||
@@ -129,7 +129,7 @@ enum { | |||
129 | Opt_err | 129 | Opt_err |
130 | }; | 130 | }; |
131 | 131 | ||
132 | static match_table_t __initconst tokens = { | 132 | static const match_table_t tokens __initconst = { |
133 | {Opt_port, "port=%u"}, | 133 | {Opt_port, "port=%u"}, |
134 | {Opt_rsize, "rsize=%u"}, | 134 | {Opt_rsize, "rsize=%u"}, |
135 | {Opt_wsize, "wsize=%u"}, | 135 | {Opt_wsize, "wsize=%u"}, |
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 81ff0f4de4b7..bd584bcf1d9f 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -1018,6 +1018,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, | |||
1018 | host_err = vfs_writev(file, (struct iovec __user *)vec, vlen, &offset); | 1018 | host_err = vfs_writev(file, (struct iovec __user *)vec, vlen, &offset); |
1019 | set_fs(oldfs); | 1019 | set_fs(oldfs); |
1020 | if (host_err >= 0) { | 1020 | if (host_err >= 0) { |
1021 | *cnt = host_err; | ||
1021 | nfsdstats.io_write += host_err; | 1022 | nfsdstats.io_write += host_err; |
1022 | fsnotify_modify(file->f_path.dentry); | 1023 | fsnotify_modify(file->f_path.dentry); |
1023 | } | 1024 | } |
@@ -1063,10 +1064,9 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, | |||
1063 | } | 1064 | } |
1064 | 1065 | ||
1065 | dprintk("nfsd: write complete host_err=%d\n", host_err); | 1066 | dprintk("nfsd: write complete host_err=%d\n", host_err); |
1066 | if (host_err >= 0) { | 1067 | if (host_err >= 0) |
1067 | err = 0; | 1068 | err = 0; |
1068 | *cnt = host_err; | 1069 | else |
1069 | } else | ||
1070 | err = nfserrno(host_err); | 1070 | err = nfserrno(host_err); |
1071 | out: | 1071 | out: |
1072 | return err; | 1072 | return err; |
diff --git a/fs/nilfs2/cpfile.c b/fs/nilfs2/cpfile.c index e90b60dfced9..300f1cdfa862 100644 --- a/fs/nilfs2/cpfile.c +++ b/fs/nilfs2/cpfile.c | |||
@@ -311,7 +311,7 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile, | |||
311 | ret = nilfs_cpfile_get_checkpoint_block(cpfile, cno, 0, &cp_bh); | 311 | ret = nilfs_cpfile_get_checkpoint_block(cpfile, cno, 0, &cp_bh); |
312 | if (ret < 0) { | 312 | if (ret < 0) { |
313 | if (ret != -ENOENT) | 313 | if (ret != -ENOENT) |
314 | goto out_sem; | 314 | goto out_header; |
315 | /* skip hole */ | 315 | /* skip hole */ |
316 | ret = 0; | 316 | ret = 0; |
317 | continue; | 317 | continue; |
@@ -344,7 +344,7 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile, | |||
344 | continue; | 344 | continue; |
345 | printk(KERN_ERR "%s: cannot delete block\n", | 345 | printk(KERN_ERR "%s: cannot delete block\n", |
346 | __func__); | 346 | __func__); |
347 | goto out_sem; | 347 | goto out_header; |
348 | } | 348 | } |
349 | } | 349 | } |
350 | 350 | ||
@@ -361,6 +361,8 @@ int nilfs_cpfile_delete_checkpoints(struct inode *cpfile, | |||
361 | nilfs_mdt_mark_dirty(cpfile); | 361 | nilfs_mdt_mark_dirty(cpfile); |
362 | kunmap_atomic(kaddr, KM_USER0); | 362 | kunmap_atomic(kaddr, KM_USER0); |
363 | } | 363 | } |
364 | |||
365 | out_header: | ||
364 | brelse(header_bh); | 366 | brelse(header_bh); |
365 | 367 | ||
366 | out_sem: | 368 | out_sem: |
diff --git a/fs/nilfs2/ioctl.c b/fs/nilfs2/ioctl.c index 50ff3f2cdf24..d6759b92006f 100644 --- a/fs/nilfs2/ioctl.c +++ b/fs/nilfs2/ioctl.c | |||
@@ -576,7 +576,7 @@ static int nilfs_ioctl_clean_segments(struct inode *inode, struct file *filp, | |||
576 | ret = nilfs_clean_segments(inode->i_sb, argv, kbufs); | 576 | ret = nilfs_clean_segments(inode->i_sb, argv, kbufs); |
577 | 577 | ||
578 | out_free: | 578 | out_free: |
579 | while (--n > 0) | 579 | while (--n >= 0) |
580 | vfree(kbufs[n]); | 580 | vfree(kbufs[n]); |
581 | kfree(kbufs[4]); | 581 | kfree(kbufs[4]); |
582 | return ret; | 582 | return ret; |
diff --git a/fs/proc/base.c b/fs/proc/base.c index 23342e188a66..1539e630c47d 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -1956,7 +1956,7 @@ static struct dentry *proc_pident_instantiate(struct inode *dir, | |||
1956 | const struct pid_entry *p = ptr; | 1956 | const struct pid_entry *p = ptr; |
1957 | struct inode *inode; | 1957 | struct inode *inode; |
1958 | struct proc_inode *ei; | 1958 | struct proc_inode *ei; |
1959 | struct dentry *error = ERR_PTR(-EINVAL); | 1959 | struct dentry *error = ERR_PTR(-ENOENT); |
1960 | 1960 | ||
1961 | inode = proc_pid_make_inode(dir->i_sb, task); | 1961 | inode = proc_pid_make_inode(dir->i_sb, task); |
1962 | if (!inode) | 1962 | if (!inode) |
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c index b1606e07b7a3..561a9c050cef 100644 --- a/fs/sysfs/file.c +++ b/fs/sysfs/file.c | |||
@@ -723,7 +723,7 @@ int sysfs_schedule_callback(struct kobject *kobj, void (*func)(void *), | |||
723 | mutex_unlock(&sysfs_workq_mutex); | 723 | mutex_unlock(&sysfs_workq_mutex); |
724 | 724 | ||
725 | if (sysfs_workqueue == NULL) { | 725 | if (sysfs_workqueue == NULL) { |
726 | sysfs_workqueue = create_workqueue("sysfsd"); | 726 | sysfs_workqueue = create_singlethread_workqueue("sysfsd"); |
727 | if (sysfs_workqueue == NULL) { | 727 | if (sysfs_workqueue == NULL) { |
728 | module_put(owner); | 728 | module_put(owner); |
729 | return -ENOMEM; | 729 | return -ENOMEM; |
diff --git a/fs/xfs/linux-2.6/kmem.h b/fs/xfs/linux-2.6/kmem.h index af6843c7ee4b..179cbd630f69 100644 --- a/fs/xfs/linux-2.6/kmem.h +++ b/fs/xfs/linux-2.6/kmem.h | |||
@@ -103,7 +103,7 @@ extern void *kmem_zone_zalloc(kmem_zone_t *, unsigned int __nocast); | |||
103 | static inline int | 103 | static inline int |
104 | kmem_shake_allow(gfp_t gfp_mask) | 104 | kmem_shake_allow(gfp_t gfp_mask) |
105 | { | 105 | { |
106 | return (gfp_mask & __GFP_WAIT) != 0; | 106 | return ((gfp_mask & __GFP_WAIT) && (gfp_mask & __GFP_FS)); |
107 | } | 107 | } |
108 | 108 | ||
109 | #endif /* __XFS_SUPPORT_KMEM_H__ */ | 109 | #endif /* __XFS_SUPPORT_KMEM_H__ */ |
diff --git a/fs/xfs/xfs_dfrag.c b/fs/xfs/xfs_dfrag.c index e6d839bddbf0..7465f9ee125f 100644 --- a/fs/xfs/xfs_dfrag.c +++ b/fs/xfs/xfs_dfrag.c | |||
@@ -347,13 +347,15 @@ xfs_swap_extents( | |||
347 | 347 | ||
348 | error = xfs_trans_commit(tp, XFS_TRANS_SWAPEXT); | 348 | error = xfs_trans_commit(tp, XFS_TRANS_SWAPEXT); |
349 | 349 | ||
350 | out_unlock: | ||
351 | xfs_iunlock(ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL); | ||
352 | xfs_iunlock(tip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL); | ||
353 | out: | 350 | out: |
354 | kmem_free(tempifp); | 351 | kmem_free(tempifp); |
355 | return error; | 352 | return error; |
356 | 353 | ||
354 | out_unlock: | ||
355 | xfs_iunlock(ip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL); | ||
356 | xfs_iunlock(tip, XFS_ILOCK_EXCL | XFS_IOLOCK_EXCL); | ||
357 | goto out; | ||
358 | |||
357 | out_trans_cancel: | 359 | out_trans_cancel: |
358 | xfs_trans_cancel(tp, 0); | 360 | xfs_trans_cancel(tp, 0); |
359 | goto out_unlock; | 361 | goto out_unlock; |
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c index 8379e3bca26c..cbd451bb4848 100644 --- a/fs/xfs/xfs_fsops.c +++ b/fs/xfs/xfs_fsops.c | |||
@@ -160,7 +160,7 @@ xfs_growfs_data_private( | |||
160 | nagcount = new + (nb_mod != 0); | 160 | nagcount = new + (nb_mod != 0); |
161 | if (nb_mod && nb_mod < XFS_MIN_AG_BLOCKS) { | 161 | if (nb_mod && nb_mod < XFS_MIN_AG_BLOCKS) { |
162 | nagcount--; | 162 | nagcount--; |
163 | nb = nagcount * mp->m_sb.sb_agblocks; | 163 | nb = (xfs_rfsblock_t)nagcount * mp->m_sb.sb_agblocks; |
164 | if (nb < mp->m_sb.sb_dblocks) | 164 | if (nb < mp->m_sb.sb_dblocks) |
165 | return XFS_ERROR(EINVAL); | 165 | return XFS_ERROR(EINVAL); |
166 | } | 166 | } |