diff options
author | Arnd Bergmann <arnd@arndb.de> | 2012-03-24 15:13:59 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2012-03-24 15:13:59 -0400 |
commit | 83fe628e16d84efc8df2731bc403eae4e4f53801 (patch) | |
tree | 9a51c292235621d0f4f632c2a55ddb5a6ab582af /fs | |
parent | 853a0231e057c04255a848f6998f84faaa635c58 (diff) | |
parent | 426f1af947c61dee48a9267f84bff227e503a547 (diff) |
Merge branch 'renesas/soc' into next/soc2
Diffstat (limited to 'fs')
-rw-r--r-- | fs/aio.c | 24 | ||||
-rw-r--r-- | fs/binfmt_aout.c | 14 | ||||
-rw-r--r-- | fs/block_dev.c | 16 | ||||
-rw-r--r-- | fs/btrfs/backref.c | 8 | ||||
-rw-r--r-- | fs/btrfs/reada.c | 2 | ||||
-rw-r--r-- | fs/cifs/dir.c | 20 | ||||
-rw-r--r-- | fs/cifs/file.c | 69 | ||||
-rw-r--r-- | fs/cifs/inode.c | 28 | ||||
-rw-r--r-- | fs/cifs/xattr.c | 6 | ||||
-rw-r--r-- | fs/dcache.c | 20 | ||||
-rw-r--r-- | fs/exec.c | 18 | ||||
-rw-r--r-- | fs/inode.c | 4 | ||||
-rw-r--r-- | fs/namei.c | 4 | ||||
-rw-r--r-- | fs/udf/file.c | 2 |
14 files changed, 160 insertions, 75 deletions
@@ -228,12 +228,6 @@ static void __put_ioctx(struct kioctx *ctx) | |||
228 | call_rcu(&ctx->rcu_head, ctx_rcu_free); | 228 | call_rcu(&ctx->rcu_head, ctx_rcu_free); |
229 | } | 229 | } |
230 | 230 | ||
231 | static inline void get_ioctx(struct kioctx *kioctx) | ||
232 | { | ||
233 | BUG_ON(atomic_read(&kioctx->users) <= 0); | ||
234 | atomic_inc(&kioctx->users); | ||
235 | } | ||
236 | |||
237 | static inline int try_get_ioctx(struct kioctx *kioctx) | 231 | static inline int try_get_ioctx(struct kioctx *kioctx) |
238 | { | 232 | { |
239 | return atomic_inc_not_zero(&kioctx->users); | 233 | return atomic_inc_not_zero(&kioctx->users); |
@@ -273,7 +267,7 @@ static struct kioctx *ioctx_alloc(unsigned nr_events) | |||
273 | mm = ctx->mm = current->mm; | 267 | mm = ctx->mm = current->mm; |
274 | atomic_inc(&mm->mm_count); | 268 | atomic_inc(&mm->mm_count); |
275 | 269 | ||
276 | atomic_set(&ctx->users, 1); | 270 | atomic_set(&ctx->users, 2); |
277 | spin_lock_init(&ctx->ctx_lock); | 271 | spin_lock_init(&ctx->ctx_lock); |
278 | spin_lock_init(&ctx->ring_info.ring_lock); | 272 | spin_lock_init(&ctx->ring_info.ring_lock); |
279 | init_waitqueue_head(&ctx->wait); | 273 | init_waitqueue_head(&ctx->wait); |
@@ -490,6 +484,8 @@ static void kiocb_batch_free(struct kioctx *ctx, struct kiocb_batch *batch) | |||
490 | kmem_cache_free(kiocb_cachep, req); | 484 | kmem_cache_free(kiocb_cachep, req); |
491 | ctx->reqs_active--; | 485 | ctx->reqs_active--; |
492 | } | 486 | } |
487 | if (unlikely(!ctx->reqs_active && ctx->dead)) | ||
488 | wake_up_all(&ctx->wait); | ||
493 | spin_unlock_irq(&ctx->ctx_lock); | 489 | spin_unlock_irq(&ctx->ctx_lock); |
494 | } | 490 | } |
495 | 491 | ||
@@ -607,11 +603,16 @@ static void aio_fput_routine(struct work_struct *data) | |||
607 | fput(req->ki_filp); | 603 | fput(req->ki_filp); |
608 | 604 | ||
609 | /* Link the iocb into the context's free list */ | 605 | /* Link the iocb into the context's free list */ |
606 | rcu_read_lock(); | ||
610 | spin_lock_irq(&ctx->ctx_lock); | 607 | spin_lock_irq(&ctx->ctx_lock); |
611 | really_put_req(ctx, req); | 608 | really_put_req(ctx, req); |
609 | /* | ||
610 | * at that point ctx might've been killed, but actual | ||
611 | * freeing is RCU'd | ||
612 | */ | ||
612 | spin_unlock_irq(&ctx->ctx_lock); | 613 | spin_unlock_irq(&ctx->ctx_lock); |
614 | rcu_read_unlock(); | ||
613 | 615 | ||
614 | put_ioctx(ctx); | ||
615 | spin_lock_irq(&fput_lock); | 616 | spin_lock_irq(&fput_lock); |
616 | } | 617 | } |
617 | spin_unlock_irq(&fput_lock); | 618 | spin_unlock_irq(&fput_lock); |
@@ -642,7 +643,6 @@ static int __aio_put_req(struct kioctx *ctx, struct kiocb *req) | |||
642 | * this function will be executed w/out any aio kthread wakeup. | 643 | * this function will be executed w/out any aio kthread wakeup. |
643 | */ | 644 | */ |
644 | if (unlikely(!fput_atomic(req->ki_filp))) { | 645 | if (unlikely(!fput_atomic(req->ki_filp))) { |
645 | get_ioctx(ctx); | ||
646 | spin_lock(&fput_lock); | 646 | spin_lock(&fput_lock); |
647 | list_add(&req->ki_list, &fput_head); | 647 | list_add(&req->ki_list, &fput_head); |
648 | spin_unlock(&fput_lock); | 648 | spin_unlock(&fput_lock); |
@@ -1336,10 +1336,10 @@ SYSCALL_DEFINE2(io_setup, unsigned, nr_events, aio_context_t __user *, ctxp) | |||
1336 | ret = PTR_ERR(ioctx); | 1336 | ret = PTR_ERR(ioctx); |
1337 | if (!IS_ERR(ioctx)) { | 1337 | if (!IS_ERR(ioctx)) { |
1338 | ret = put_user(ioctx->user_id, ctxp); | 1338 | ret = put_user(ioctx->user_id, ctxp); |
1339 | if (!ret) | 1339 | if (!ret) { |
1340 | put_ioctx(ioctx); | ||
1340 | return 0; | 1341 | return 0; |
1341 | 1342 | } | |
1342 | get_ioctx(ioctx); /* io_destroy() expects us to hold a ref */ | ||
1343 | io_destroy(ioctx); | 1343 | io_destroy(ioctx); |
1344 | } | 1344 | } |
1345 | 1345 | ||
diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c index a6395bdb26ae..1ff94054d35a 100644 --- a/fs/binfmt_aout.c +++ b/fs/binfmt_aout.c | |||
@@ -259,6 +259,13 @@ static int load_aout_binary(struct linux_binprm * bprm, struct pt_regs * regs) | |||
259 | current->mm->free_area_cache = current->mm->mmap_base; | 259 | current->mm->free_area_cache = current->mm->mmap_base; |
260 | current->mm->cached_hole_size = 0; | 260 | current->mm->cached_hole_size = 0; |
261 | 261 | ||
262 | retval = setup_arg_pages(bprm, STACK_TOP, EXSTACK_DEFAULT); | ||
263 | if (retval < 0) { | ||
264 | /* Someone check-me: is this error path enough? */ | ||
265 | send_sig(SIGKILL, current, 0); | ||
266 | return retval; | ||
267 | } | ||
268 | |||
262 | install_exec_creds(bprm); | 269 | install_exec_creds(bprm); |
263 | current->flags &= ~PF_FORKNOEXEC; | 270 | current->flags &= ~PF_FORKNOEXEC; |
264 | 271 | ||
@@ -352,13 +359,6 @@ beyond_if: | |||
352 | return retval; | 359 | return retval; |
353 | } | 360 | } |
354 | 361 | ||
355 | retval = setup_arg_pages(bprm, STACK_TOP, EXSTACK_DEFAULT); | ||
356 | if (retval < 0) { | ||
357 | /* Someone check-me: is this error path enough? */ | ||
358 | send_sig(SIGKILL, current, 0); | ||
359 | return retval; | ||
360 | } | ||
361 | |||
362 | current->mm->start_stack = | 362 | current->mm->start_stack = |
363 | (unsigned long) create_aout_tables((char __user *) bprm->p, bprm); | 363 | (unsigned long) create_aout_tables((char __user *) bprm->p, bprm); |
364 | #ifdef __alpha__ | 364 | #ifdef __alpha__ |
diff --git a/fs/block_dev.c b/fs/block_dev.c index 0e575d1304b4..5e9f198f7712 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -1183,8 +1183,12 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) | |||
1183 | * The latter is necessary to prevent ghost | 1183 | * The latter is necessary to prevent ghost |
1184 | * partitions on a removed medium. | 1184 | * partitions on a removed medium. |
1185 | */ | 1185 | */ |
1186 | if (bdev->bd_invalidated && (!ret || ret == -ENOMEDIUM)) | 1186 | if (bdev->bd_invalidated) { |
1187 | rescan_partitions(disk, bdev); | 1187 | if (!ret) |
1188 | rescan_partitions(disk, bdev); | ||
1189 | else if (ret == -ENOMEDIUM) | ||
1190 | invalidate_partitions(disk, bdev); | ||
1191 | } | ||
1188 | if (ret) | 1192 | if (ret) |
1189 | goto out_clear; | 1193 | goto out_clear; |
1190 | } else { | 1194 | } else { |
@@ -1214,8 +1218,12 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) | |||
1214 | if (bdev->bd_disk->fops->open) | 1218 | if (bdev->bd_disk->fops->open) |
1215 | ret = bdev->bd_disk->fops->open(bdev, mode); | 1219 | ret = bdev->bd_disk->fops->open(bdev, mode); |
1216 | /* the same as first opener case, read comment there */ | 1220 | /* the same as first opener case, read comment there */ |
1217 | if (bdev->bd_invalidated && (!ret || ret == -ENOMEDIUM)) | 1221 | if (bdev->bd_invalidated) { |
1218 | rescan_partitions(bdev->bd_disk, bdev); | 1222 | if (!ret) |
1223 | rescan_partitions(bdev->bd_disk, bdev); | ||
1224 | else if (ret == -ENOMEDIUM) | ||
1225 | invalidate_partitions(bdev->bd_disk, bdev); | ||
1226 | } | ||
1219 | if (ret) | 1227 | if (ret) |
1220 | goto out_unlock_bdev; | 1228 | goto out_unlock_bdev; |
1221 | } | 1229 | } |
diff --git a/fs/btrfs/backref.c b/fs/btrfs/backref.c index 98f6bf10bbd4..0436c12da8c2 100644 --- a/fs/btrfs/backref.c +++ b/fs/btrfs/backref.c | |||
@@ -583,7 +583,7 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans, | |||
583 | struct btrfs_path *path; | 583 | struct btrfs_path *path; |
584 | struct btrfs_key info_key = { 0 }; | 584 | struct btrfs_key info_key = { 0 }; |
585 | struct btrfs_delayed_ref_root *delayed_refs = NULL; | 585 | struct btrfs_delayed_ref_root *delayed_refs = NULL; |
586 | struct btrfs_delayed_ref_head *head = NULL; | 586 | struct btrfs_delayed_ref_head *head; |
587 | int info_level = 0; | 587 | int info_level = 0; |
588 | int ret; | 588 | int ret; |
589 | struct list_head prefs_delayed; | 589 | struct list_head prefs_delayed; |
@@ -607,6 +607,8 @@ static int find_parent_nodes(struct btrfs_trans_handle *trans, | |||
607 | * at a specified point in time | 607 | * at a specified point in time |
608 | */ | 608 | */ |
609 | again: | 609 | again: |
610 | head = NULL; | ||
611 | |||
610 | ret = btrfs_search_slot(trans, fs_info->extent_root, &key, path, 0, 0); | 612 | ret = btrfs_search_slot(trans, fs_info->extent_root, &key, path, 0, 0); |
611 | if (ret < 0) | 613 | if (ret < 0) |
612 | goto out; | 614 | goto out; |
@@ -635,8 +637,10 @@ again: | |||
635 | goto again; | 637 | goto again; |
636 | } | 638 | } |
637 | ret = __add_delayed_refs(head, seq, &info_key, &prefs_delayed); | 639 | ret = __add_delayed_refs(head, seq, &info_key, &prefs_delayed); |
638 | if (ret) | 640 | if (ret) { |
641 | spin_unlock(&delayed_refs->lock); | ||
639 | goto out; | 642 | goto out; |
643 | } | ||
640 | } | 644 | } |
641 | spin_unlock(&delayed_refs->lock); | 645 | spin_unlock(&delayed_refs->lock); |
642 | 646 | ||
diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c index 2373b39a132b..22db04550f6a 100644 --- a/fs/btrfs/reada.c +++ b/fs/btrfs/reada.c | |||
@@ -305,7 +305,7 @@ again: | |||
305 | 305 | ||
306 | spin_lock(&fs_info->reada_lock); | 306 | spin_lock(&fs_info->reada_lock); |
307 | ret = radix_tree_insert(&dev->reada_zones, | 307 | ret = radix_tree_insert(&dev->reada_zones, |
308 | (unsigned long)zone->end >> PAGE_CACHE_SHIFT, | 308 | (unsigned long)(zone->end >> PAGE_CACHE_SHIFT), |
309 | zone); | 309 | zone); |
310 | spin_unlock(&fs_info->reada_lock); | 310 | spin_unlock(&fs_info->reada_lock); |
311 | 311 | ||
diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 63a196b97d50..bc7e24420ac0 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c | |||
@@ -584,10 +584,26 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, | |||
584 | * If either that or op not supported returned, follow | 584 | * If either that or op not supported returned, follow |
585 | * the normal lookup. | 585 | * the normal lookup. |
586 | */ | 586 | */ |
587 | if ((rc == 0) || (rc == -ENOENT)) | 587 | switch (rc) { |
588 | case 0: | ||
589 | /* | ||
590 | * The server may allow us to open things like | ||
591 | * FIFOs, but the client isn't set up to deal | ||
592 | * with that. If it's not a regular file, just | ||
593 | * close it and proceed as if it were a normal | ||
594 | * lookup. | ||
595 | */ | ||
596 | if (newInode && !S_ISREG(newInode->i_mode)) { | ||
597 | CIFSSMBClose(xid, pTcon, fileHandle); | ||
598 | break; | ||
599 | } | ||
600 | case -ENOENT: | ||
588 | posix_open = true; | 601 | posix_open = true; |
589 | else if ((rc == -EINVAL) || (rc != -EOPNOTSUPP)) | 602 | case -EOPNOTSUPP: |
603 | break; | ||
604 | default: | ||
590 | pTcon->broken_posix_open = true; | 605 | pTcon->broken_posix_open = true; |
606 | } | ||
591 | } | 607 | } |
592 | if (!posix_open) | 608 | if (!posix_open) |
593 | rc = cifs_get_inode_info_unix(&newInode, full_path, | 609 | rc = cifs_get_inode_info_unix(&newInode, full_path, |
diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 4dd9283885e7..5e64748a2917 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c | |||
@@ -920,16 +920,26 @@ cifs_push_mandatory_locks(struct cifsFileInfo *cfile) | |||
920 | for (lockp = &inode->i_flock; *lockp != NULL; \ | 920 | for (lockp = &inode->i_flock; *lockp != NULL; \ |
921 | lockp = &(*lockp)->fl_next) | 921 | lockp = &(*lockp)->fl_next) |
922 | 922 | ||
923 | struct lock_to_push { | ||
924 | struct list_head llist; | ||
925 | __u64 offset; | ||
926 | __u64 length; | ||
927 | __u32 pid; | ||
928 | __u16 netfid; | ||
929 | __u8 type; | ||
930 | }; | ||
931 | |||
923 | static int | 932 | static int |
924 | cifs_push_posix_locks(struct cifsFileInfo *cfile) | 933 | cifs_push_posix_locks(struct cifsFileInfo *cfile) |
925 | { | 934 | { |
926 | struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode); | 935 | struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode); |
927 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); | 936 | struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); |
928 | struct file_lock *flock, **before; | 937 | struct file_lock *flock, **before; |
929 | struct cifsLockInfo *lck, *tmp; | 938 | unsigned int count = 0, i = 0; |
930 | int rc = 0, xid, type; | 939 | int rc = 0, xid, type; |
940 | struct list_head locks_to_send, *el; | ||
941 | struct lock_to_push *lck, *tmp; | ||
931 | __u64 length; | 942 | __u64 length; |
932 | struct list_head locks_to_send; | ||
933 | 943 | ||
934 | xid = GetXid(); | 944 | xid = GetXid(); |
935 | 945 | ||
@@ -940,29 +950,55 @@ cifs_push_posix_locks(struct cifsFileInfo *cfile) | |||
940 | return rc; | 950 | return rc; |
941 | } | 951 | } |
942 | 952 | ||
953 | lock_flocks(); | ||
954 | cifs_for_each_lock(cfile->dentry->d_inode, before) { | ||
955 | if ((*before)->fl_flags & FL_POSIX) | ||
956 | count++; | ||
957 | } | ||
958 | unlock_flocks(); | ||
959 | |||
943 | INIT_LIST_HEAD(&locks_to_send); | 960 | INIT_LIST_HEAD(&locks_to_send); |
944 | 961 | ||
962 | /* | ||
963 | * Allocating count locks is enough because no locks can be added to | ||
964 | * the list while we are holding cinode->lock_mutex that protects | ||
965 | * locking operations of this inode. | ||
966 | */ | ||
967 | for (; i < count; i++) { | ||
968 | lck = kmalloc(sizeof(struct lock_to_push), GFP_KERNEL); | ||
969 | if (!lck) { | ||
970 | rc = -ENOMEM; | ||
971 | goto err_out; | ||
972 | } | ||
973 | list_add_tail(&lck->llist, &locks_to_send); | ||
974 | } | ||
975 | |||
976 | i = 0; | ||
977 | el = locks_to_send.next; | ||
945 | lock_flocks(); | 978 | lock_flocks(); |
946 | cifs_for_each_lock(cfile->dentry->d_inode, before) { | 979 | cifs_for_each_lock(cfile->dentry->d_inode, before) { |
980 | if (el == &locks_to_send) { | ||
981 | /* something is really wrong */ | ||
982 | cERROR(1, "Can't push all brlocks!"); | ||
983 | break; | ||
984 | } | ||
947 | flock = *before; | 985 | flock = *before; |
986 | if ((flock->fl_flags & FL_POSIX) == 0) | ||
987 | continue; | ||
948 | length = 1 + flock->fl_end - flock->fl_start; | 988 | length = 1 + flock->fl_end - flock->fl_start; |
949 | if (flock->fl_type == F_RDLCK || flock->fl_type == F_SHLCK) | 989 | if (flock->fl_type == F_RDLCK || flock->fl_type == F_SHLCK) |
950 | type = CIFS_RDLCK; | 990 | type = CIFS_RDLCK; |
951 | else | 991 | else |
952 | type = CIFS_WRLCK; | 992 | type = CIFS_WRLCK; |
953 | 993 | lck = list_entry(el, struct lock_to_push, llist); | |
954 | lck = cifs_lock_init(flock->fl_start, length, type, | ||
955 | cfile->netfid); | ||
956 | if (!lck) { | ||
957 | rc = -ENOMEM; | ||
958 | goto send_locks; | ||
959 | } | ||
960 | lck->pid = flock->fl_pid; | 994 | lck->pid = flock->fl_pid; |
961 | 995 | lck->netfid = cfile->netfid; | |
962 | list_add_tail(&lck->llist, &locks_to_send); | 996 | lck->length = length; |
997 | lck->type = type; | ||
998 | lck->offset = flock->fl_start; | ||
999 | i++; | ||
1000 | el = el->next; | ||
963 | } | 1001 | } |
964 | |||
965 | send_locks: | ||
966 | unlock_flocks(); | 1002 | unlock_flocks(); |
967 | 1003 | ||
968 | list_for_each_entry_safe(lck, tmp, &locks_to_send, llist) { | 1004 | list_for_each_entry_safe(lck, tmp, &locks_to_send, llist) { |
@@ -979,11 +1015,18 @@ send_locks: | |||
979 | kfree(lck); | 1015 | kfree(lck); |
980 | } | 1016 | } |
981 | 1017 | ||
1018 | out: | ||
982 | cinode->can_cache_brlcks = false; | 1019 | cinode->can_cache_brlcks = false; |
983 | mutex_unlock(&cinode->lock_mutex); | 1020 | mutex_unlock(&cinode->lock_mutex); |
984 | 1021 | ||
985 | FreeXid(xid); | 1022 | FreeXid(xid); |
986 | return rc; | 1023 | return rc; |
1024 | err_out: | ||
1025 | list_for_each_entry_safe(lck, tmp, &locks_to_send, llist) { | ||
1026 | list_del(&lck->llist); | ||
1027 | kfree(lck); | ||
1028 | } | ||
1029 | goto out; | ||
987 | } | 1030 | } |
988 | 1031 | ||
989 | static int | 1032 | static int |
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index a5f54b7d9822..745da3d0653e 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c | |||
@@ -534,6 +534,11 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info, | |||
534 | if (fattr->cf_cifsattrs & ATTR_DIRECTORY) { | 534 | if (fattr->cf_cifsattrs & ATTR_DIRECTORY) { |
535 | fattr->cf_mode = S_IFDIR | cifs_sb->mnt_dir_mode; | 535 | fattr->cf_mode = S_IFDIR | cifs_sb->mnt_dir_mode; |
536 | fattr->cf_dtype = DT_DIR; | 536 | fattr->cf_dtype = DT_DIR; |
537 | /* | ||
538 | * Server can return wrong NumberOfLinks value for directories | ||
539 | * when Unix extensions are disabled - fake it. | ||
540 | */ | ||
541 | fattr->cf_nlink = 2; | ||
537 | } else { | 542 | } else { |
538 | fattr->cf_mode = S_IFREG | cifs_sb->mnt_file_mode; | 543 | fattr->cf_mode = S_IFREG | cifs_sb->mnt_file_mode; |
539 | fattr->cf_dtype = DT_REG; | 544 | fattr->cf_dtype = DT_REG; |
@@ -541,9 +546,9 @@ cifs_all_info_to_fattr(struct cifs_fattr *fattr, FILE_ALL_INFO *info, | |||
541 | /* clear write bits if ATTR_READONLY is set */ | 546 | /* clear write bits if ATTR_READONLY is set */ |
542 | if (fattr->cf_cifsattrs & ATTR_READONLY) | 547 | if (fattr->cf_cifsattrs & ATTR_READONLY) |
543 | fattr->cf_mode &= ~(S_IWUGO); | 548 | fattr->cf_mode &= ~(S_IWUGO); |
544 | } | ||
545 | 549 | ||
546 | fattr->cf_nlink = le32_to_cpu(info->NumberOfLinks); | 550 | fattr->cf_nlink = le32_to_cpu(info->NumberOfLinks); |
551 | } | ||
547 | 552 | ||
548 | fattr->cf_uid = cifs_sb->mnt_uid; | 553 | fattr->cf_uid = cifs_sb->mnt_uid; |
549 | fattr->cf_gid = cifs_sb->mnt_gid; | 554 | fattr->cf_gid = cifs_sb->mnt_gid; |
@@ -1322,7 +1327,6 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, umode_t mode) | |||
1322 | } | 1327 | } |
1323 | /*BB check (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID ) to see if need | 1328 | /*BB check (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID ) to see if need |
1324 | to set uid/gid */ | 1329 | to set uid/gid */ |
1325 | inc_nlink(inode); | ||
1326 | 1330 | ||
1327 | cifs_unix_basic_to_fattr(&fattr, pInfo, cifs_sb); | 1331 | cifs_unix_basic_to_fattr(&fattr, pInfo, cifs_sb); |
1328 | cifs_fill_uniqueid(inode->i_sb, &fattr); | 1332 | cifs_fill_uniqueid(inode->i_sb, &fattr); |
@@ -1355,7 +1359,6 @@ mkdir_retry_old: | |||
1355 | d_drop(direntry); | 1359 | d_drop(direntry); |
1356 | } else { | 1360 | } else { |
1357 | mkdir_get_info: | 1361 | mkdir_get_info: |
1358 | inc_nlink(inode); | ||
1359 | if (pTcon->unix_ext) | 1362 | if (pTcon->unix_ext) |
1360 | rc = cifs_get_inode_info_unix(&newinode, full_path, | 1363 | rc = cifs_get_inode_info_unix(&newinode, full_path, |
1361 | inode->i_sb, xid); | 1364 | inode->i_sb, xid); |
@@ -1436,6 +1439,11 @@ mkdir_get_info: | |||
1436 | } | 1439 | } |
1437 | } | 1440 | } |
1438 | mkdir_out: | 1441 | mkdir_out: |
1442 | /* | ||
1443 | * Force revalidate to get parent dir info when needed since cached | ||
1444 | * attributes are invalid now. | ||
1445 | */ | ||
1446 | CIFS_I(inode)->time = 0; | ||
1439 | kfree(full_path); | 1447 | kfree(full_path); |
1440 | FreeXid(xid); | 1448 | FreeXid(xid); |
1441 | cifs_put_tlink(tlink); | 1449 | cifs_put_tlink(tlink); |
@@ -1475,7 +1483,6 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry) | |||
1475 | cifs_put_tlink(tlink); | 1483 | cifs_put_tlink(tlink); |
1476 | 1484 | ||
1477 | if (!rc) { | 1485 | if (!rc) { |
1478 | drop_nlink(inode); | ||
1479 | spin_lock(&direntry->d_inode->i_lock); | 1486 | spin_lock(&direntry->d_inode->i_lock); |
1480 | i_size_write(direntry->d_inode, 0); | 1487 | i_size_write(direntry->d_inode, 0); |
1481 | clear_nlink(direntry->d_inode); | 1488 | clear_nlink(direntry->d_inode); |
@@ -1483,12 +1490,15 @@ int cifs_rmdir(struct inode *inode, struct dentry *direntry) | |||
1483 | } | 1490 | } |
1484 | 1491 | ||
1485 | cifsInode = CIFS_I(direntry->d_inode); | 1492 | cifsInode = CIFS_I(direntry->d_inode); |
1486 | cifsInode->time = 0; /* force revalidate to go get info when | 1493 | /* force revalidate to go get info when needed */ |
1487 | needed */ | 1494 | cifsInode->time = 0; |
1488 | 1495 | ||
1489 | cifsInode = CIFS_I(inode); | 1496 | cifsInode = CIFS_I(inode); |
1490 | cifsInode->time = 0; /* force revalidate to get parent dir info | 1497 | /* |
1491 | since cached search results now invalid */ | 1498 | * Force revalidate to get parent dir info when needed since cached |
1499 | * attributes are invalid now. | ||
1500 | */ | ||
1501 | cifsInode->time = 0; | ||
1492 | 1502 | ||
1493 | direntry->d_inode->i_ctime = inode->i_ctime = inode->i_mtime = | 1503 | direntry->d_inode->i_ctime = inode->i_ctime = inode->i_mtime = |
1494 | current_fs_time(inode->i_sb); | 1504 | current_fs_time(inode->i_sb); |
diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c index 45f07c46f3ed..10d92cf57ab6 100644 --- a/fs/cifs/xattr.c +++ b/fs/cifs/xattr.c | |||
@@ -105,7 +105,6 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name, | |||
105 | struct cifs_tcon *pTcon; | 105 | struct cifs_tcon *pTcon; |
106 | struct super_block *sb; | 106 | struct super_block *sb; |
107 | char *full_path; | 107 | char *full_path; |
108 | struct cifs_ntsd *pacl; | ||
109 | 108 | ||
110 | if (direntry == NULL) | 109 | if (direntry == NULL) |
111 | return -EIO; | 110 | return -EIO; |
@@ -164,23 +163,24 @@ int cifs_setxattr(struct dentry *direntry, const char *ea_name, | |||
164 | cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); | 163 | cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); |
165 | } else if (strncmp(ea_name, CIFS_XATTR_CIFS_ACL, | 164 | } else if (strncmp(ea_name, CIFS_XATTR_CIFS_ACL, |
166 | strlen(CIFS_XATTR_CIFS_ACL)) == 0) { | 165 | strlen(CIFS_XATTR_CIFS_ACL)) == 0) { |
166 | #ifdef CONFIG_CIFS_ACL | ||
167 | struct cifs_ntsd *pacl; | ||
167 | pacl = kmalloc(value_size, GFP_KERNEL); | 168 | pacl = kmalloc(value_size, GFP_KERNEL); |
168 | if (!pacl) { | 169 | if (!pacl) { |
169 | cFYI(1, "%s: Can't allocate memory for ACL", | 170 | cFYI(1, "%s: Can't allocate memory for ACL", |
170 | __func__); | 171 | __func__); |
171 | rc = -ENOMEM; | 172 | rc = -ENOMEM; |
172 | } else { | 173 | } else { |
173 | #ifdef CONFIG_CIFS_ACL | ||
174 | memcpy(pacl, ea_value, value_size); | 174 | memcpy(pacl, ea_value, value_size); |
175 | rc = set_cifs_acl(pacl, value_size, | 175 | rc = set_cifs_acl(pacl, value_size, |
176 | direntry->d_inode, full_path, CIFS_ACL_DACL); | 176 | direntry->d_inode, full_path, CIFS_ACL_DACL); |
177 | if (rc == 0) /* force revalidate of the inode */ | 177 | if (rc == 0) /* force revalidate of the inode */ |
178 | CIFS_I(direntry->d_inode)->time = 0; | 178 | CIFS_I(direntry->d_inode)->time = 0; |
179 | kfree(pacl); | 179 | kfree(pacl); |
180 | } | ||
180 | #else | 181 | #else |
181 | cFYI(1, "Set CIFS ACL not supported yet"); | 182 | cFYI(1, "Set CIFS ACL not supported yet"); |
182 | #endif /* CONFIG_CIFS_ACL */ | 183 | #endif /* CONFIG_CIFS_ACL */ |
183 | } | ||
184 | } else { | 184 | } else { |
185 | int temp; | 185 | int temp; |
186 | temp = strncmp(ea_name, POSIX_ACL_XATTR_ACCESS, | 186 | temp = strncmp(ea_name, POSIX_ACL_XATTR_ACCESS, |
diff --git a/fs/dcache.c b/fs/dcache.c index 138be96e25b6..bcbdb33fcc20 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -137,6 +137,26 @@ int proc_nr_dentry(ctl_table *table, int write, void __user *buffer, | |||
137 | } | 137 | } |
138 | #endif | 138 | #endif |
139 | 139 | ||
140 | /* | ||
141 | * Compare 2 name strings, return 0 if they match, otherwise non-zero. | ||
142 | * The strings are both count bytes long, and count is non-zero. | ||
143 | */ | ||
144 | static inline int dentry_cmp(const unsigned char *cs, size_t scount, | ||
145 | const unsigned char *ct, size_t tcount) | ||
146 | { | ||
147 | if (scount != tcount) | ||
148 | return 1; | ||
149 | |||
150 | do { | ||
151 | if (*cs != *ct) | ||
152 | return 1; | ||
153 | cs++; | ||
154 | ct++; | ||
155 | tcount--; | ||
156 | } while (tcount); | ||
157 | return 0; | ||
158 | } | ||
159 | |||
140 | static void __d_free(struct rcu_head *head) | 160 | static void __d_free(struct rcu_head *head) |
141 | { | 161 | { |
142 | struct dentry *dentry = container_of(head, struct dentry, d_u.d_rcu); | 162 | struct dentry *dentry = container_of(head, struct dentry, d_u.d_rcu); |
@@ -1915,7 +1915,6 @@ static int coredump_wait(int exit_code, struct core_state *core_state) | |||
1915 | { | 1915 | { |
1916 | struct task_struct *tsk = current; | 1916 | struct task_struct *tsk = current; |
1917 | struct mm_struct *mm = tsk->mm; | 1917 | struct mm_struct *mm = tsk->mm; |
1918 | struct completion *vfork_done; | ||
1919 | int core_waiters = -EBUSY; | 1918 | int core_waiters = -EBUSY; |
1920 | 1919 | ||
1921 | init_completion(&core_state->startup); | 1920 | init_completion(&core_state->startup); |
@@ -1927,22 +1926,9 @@ static int coredump_wait(int exit_code, struct core_state *core_state) | |||
1927 | core_waiters = zap_threads(tsk, mm, core_state, exit_code); | 1926 | core_waiters = zap_threads(tsk, mm, core_state, exit_code); |
1928 | up_write(&mm->mmap_sem); | 1927 | up_write(&mm->mmap_sem); |
1929 | 1928 | ||
1930 | if (unlikely(core_waiters < 0)) | 1929 | if (core_waiters > 0) |
1931 | goto fail; | ||
1932 | |||
1933 | /* | ||
1934 | * Make sure nobody is waiting for us to release the VM, | ||
1935 | * otherwise we can deadlock when we wait on each other | ||
1936 | */ | ||
1937 | vfork_done = tsk->vfork_done; | ||
1938 | if (vfork_done) { | ||
1939 | tsk->vfork_done = NULL; | ||
1940 | complete(vfork_done); | ||
1941 | } | ||
1942 | |||
1943 | if (core_waiters) | ||
1944 | wait_for_completion(&core_state->startup); | 1930 | wait_for_completion(&core_state->startup); |
1945 | fail: | 1931 | |
1946 | return core_waiters; | 1932 | return core_waiters; |
1947 | } | 1933 | } |
1948 | 1934 | ||
diff --git a/fs/inode.c b/fs/inode.c index d3ebdbe723d0..83ab215baab1 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -938,8 +938,7 @@ void lockdep_annotate_inode_mutex_key(struct inode *inode) | |||
938 | struct file_system_type *type = inode->i_sb->s_type; | 938 | struct file_system_type *type = inode->i_sb->s_type; |
939 | 939 | ||
940 | /* Set new key only if filesystem hasn't already changed it */ | 940 | /* Set new key only if filesystem hasn't already changed it */ |
941 | if (!lockdep_match_class(&inode->i_mutex, | 941 | if (lockdep_match_class(&inode->i_mutex, &type->i_mutex_key)) { |
942 | &type->i_mutex_key)) { | ||
943 | /* | 942 | /* |
944 | * ensure nobody is actually holding i_mutex | 943 | * ensure nobody is actually holding i_mutex |
945 | */ | 944 | */ |
@@ -966,6 +965,7 @@ void unlock_new_inode(struct inode *inode) | |||
966 | spin_lock(&inode->i_lock); | 965 | spin_lock(&inode->i_lock); |
967 | WARN_ON(!(inode->i_state & I_NEW)); | 966 | WARN_ON(!(inode->i_state & I_NEW)); |
968 | inode->i_state &= ~I_NEW; | 967 | inode->i_state &= ~I_NEW; |
968 | smp_mb(); | ||
969 | wake_up_bit(&inode->i_state, __I_NEW); | 969 | wake_up_bit(&inode->i_state, __I_NEW); |
970 | spin_unlock(&inode->i_lock); | 970 | spin_unlock(&inode->i_lock); |
971 | } | 971 | } |
diff --git a/fs/namei.c b/fs/namei.c index e2ba62820a0f..46ea9cc16647 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -2162,7 +2162,7 @@ static struct file *do_last(struct nameidata *nd, struct path *path, | |||
2162 | /* sayonara */ | 2162 | /* sayonara */ |
2163 | error = complete_walk(nd); | 2163 | error = complete_walk(nd); |
2164 | if (error) | 2164 | if (error) |
2165 | return ERR_PTR(-ECHILD); | 2165 | return ERR_PTR(error); |
2166 | 2166 | ||
2167 | error = -ENOTDIR; | 2167 | error = -ENOTDIR; |
2168 | if (nd->flags & LOOKUP_DIRECTORY) { | 2168 | if (nd->flags & LOOKUP_DIRECTORY) { |
@@ -2261,7 +2261,7 @@ static struct file *do_last(struct nameidata *nd, struct path *path, | |||
2261 | /* Why this, you ask? _Now_ we might have grown LOOKUP_JUMPED... */ | 2261 | /* Why this, you ask? _Now_ we might have grown LOOKUP_JUMPED... */ |
2262 | error = complete_walk(nd); | 2262 | error = complete_walk(nd); |
2263 | if (error) | 2263 | if (error) |
2264 | goto exit; | 2264 | return ERR_PTR(error); |
2265 | error = -EISDIR; | 2265 | error = -EISDIR; |
2266 | if (S_ISDIR(nd->inode->i_mode)) | 2266 | if (S_ISDIR(nd->inode->i_mode)) |
2267 | goto exit; | 2267 | goto exit; |
diff --git a/fs/udf/file.c b/fs/udf/file.c index dca0c3881e82..d567b8448dfc 100644 --- a/fs/udf/file.c +++ b/fs/udf/file.c | |||
@@ -201,12 +201,10 @@ out: | |||
201 | static int udf_release_file(struct inode *inode, struct file *filp) | 201 | static int udf_release_file(struct inode *inode, struct file *filp) |
202 | { | 202 | { |
203 | if (filp->f_mode & FMODE_WRITE) { | 203 | if (filp->f_mode & FMODE_WRITE) { |
204 | mutex_lock(&inode->i_mutex); | ||
205 | down_write(&UDF_I(inode)->i_data_sem); | 204 | down_write(&UDF_I(inode)->i_data_sem); |
206 | udf_discard_prealloc(inode); | 205 | udf_discard_prealloc(inode); |
207 | udf_truncate_tail_extent(inode); | 206 | udf_truncate_tail_extent(inode); |
208 | up_write(&UDF_I(inode)->i_data_sem); | 207 | up_write(&UDF_I(inode)->i_data_sem); |
209 | mutex_unlock(&inode->i_mutex); | ||
210 | } | 208 | } |
211 | return 0; | 209 | return 0; |
212 | } | 210 | } |