aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/binfmt_em86.c2
-rw-r--r--fs/binfmt_misc.c2
-rw-r--r--fs/binfmt_script.c2
-rw-r--r--fs/isofs/inode.c2
-rw-r--r--fs/jfs/jfs_dtree.c2
-rw-r--r--fs/nfs/delegation.c3
-rw-r--r--fs/nfs/dir.c14
-rw-r--r--fs/nfs/file.c2
-rw-r--r--fs/nfs/inode.c25
-rw-r--r--fs/nfs/nfs4_fs.h4
-rw-r--r--fs/nfs/nfs4proc.c19
-rw-r--r--fs/nfs/nfs4state.c14
-rw-r--r--fs/nfs/nfsroot.c2
-rw-r--r--fs/nfs/unlink.c117
-rw-r--r--fs/nfs/write.c17
-rw-r--r--fs/ntfs/ChangeLog4
-rw-r--r--fs/ntfs/sysctl.c2
-rw-r--r--fs/ntfs/sysctl.h2
-rw-r--r--fs/ocfs2/dcache.c2
-rw-r--r--fs/reiserfs/super.c2
-rw-r--r--fs/super.c6
-rw-r--r--fs/sysfs/file.c2
22 files changed, 194 insertions, 53 deletions
diff --git a/fs/binfmt_em86.c b/fs/binfmt_em86.c
index 576dd7de2278..f95ae9789c91 100644
--- a/fs/binfmt_em86.c
+++ b/fs/binfmt_em86.c
@@ -2,7 +2,7 @@
2 * linux/fs/binfmt_em86.c 2 * linux/fs/binfmt_em86.c
3 * 3 *
4 * Based on linux/fs/binfmt_script.c 4 * Based on linux/fs/binfmt_script.c
5 * Copyright (C) 1996 Martin von Löwis 5 * Copyright (C) 1996 Martin von Löwis
6 * original #!-checking implemented by tytso. 6 * original #!-checking implemented by tytso.
7 * 7 *
8 * em86 changes Copyright (C) 1997 Jim Paradis 8 * em86 changes Copyright (C) 1997 Jim Paradis
diff --git a/fs/binfmt_misc.c b/fs/binfmt_misc.c
index 42e94b3ab7be..b53c7e5f41bb 100644
--- a/fs/binfmt_misc.c
+++ b/fs/binfmt_misc.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * binfmt_misc.c 2 * binfmt_misc.c
3 * 3 *
4 * Copyright (C) 1997 Richard Günther 4 * Copyright (C) 1997 Richard Günther
5 * 5 *
6 * binfmt_misc detects binaries via a magic or filename extension and invokes 6 * binfmt_misc detects binaries via a magic or filename extension and invokes
7 * a specified wrapper. This should obsolete binfmt_java, binfmt_em86 and 7 * a specified wrapper. This should obsolete binfmt_java, binfmt_em86 and
diff --git a/fs/binfmt_script.c b/fs/binfmt_script.c
index 4d0e0f6d3273..ab33939b12a7 100644
--- a/fs/binfmt_script.c
+++ b/fs/binfmt_script.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * linux/fs/binfmt_script.c 2 * linux/fs/binfmt_script.c
3 * 3 *
4 * Copyright (C) 1996 Martin von Löwis 4 * Copyright (C) 1996 Martin von Löwis
5 * original #!-checking implemented by tytso. 5 * original #!-checking implemented by tytso.
6 */ 6 */
7 7
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index aa359a2e4ce6..09e3d306e96f 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * (C) 1991 Linus Torvalds - minix filesystem 4 * (C) 1991 Linus Torvalds - minix filesystem
5 * 1992, 1993, 1994 Eric Youngdale Modified for ISO 9660 filesystem. 5 * 1992, 1993, 1994 Eric Youngdale Modified for ISO 9660 filesystem.
6 * 1994 Eberhard Moenkeberg - multi session handling. 6 * 1994 Eberhard Mönkeberg - multi session handling.
7 * 1995 Mark Dobie - allow mounting of some weird VideoCDs and PhotoCDs. 7 * 1995 Mark Dobie - allow mounting of some weird VideoCDs and PhotoCDs.
8 * 1997 Gordon Chaffee - Joliet CDs 8 * 1997 Gordon Chaffee - Joliet CDs
9 * 1998 Eric Lammerts - ISO 9660 Level 3 9 * 1998 Eric Lammerts - ISO 9660 Level 3
diff --git a/fs/jfs/jfs_dtree.c b/fs/jfs/jfs_dtree.c
index df0b8535de84..df25ecc418af 100644
--- a/fs/jfs/jfs_dtree.c
+++ b/fs/jfs/jfs_dtree.c
@@ -773,7 +773,7 @@ int dtSearch(struct inode *ip, struct component_name * key, ino_t * data,
773 getChild: 773 getChild:
774 /* update max. number of pages to split */ 774 /* update max. number of pages to split */
775 if (BT_STACK_FULL(btstack)) { 775 if (BT_STACK_FULL(btstack)) {
776 /* Something's corrupted, mark filesytem dirty so 776 /* Something's corrupted, mark filesystem dirty so
777 * chkdsk will fix it. 777 * chkdsk will fix it.
778 */ 778 */
779 jfs_error(sb, "stack overrun in dtSearch!"); 779 jfs_error(sb, "stack overrun in dtSearch!");
diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
index af8b235d405d..11833f4caeaa 100644
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -168,7 +168,8 @@ int nfs_inode_set_delegation(struct inode *inode, struct rpc_cred *cred, struct
168 spin_unlock(&inode->i_lock); 168 spin_unlock(&inode->i_lock);
169 169
170 spin_unlock(&clp->cl_lock); 170 spin_unlock(&clp->cl_lock);
171 kfree(delegation); 171 if (delegation != NULL)
172 nfs_free_delegation(delegation);
172 return status; 173 return status;
173} 174}
174 175
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 8ec7fbd8240c..35334539d947 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -562,6 +562,7 @@ static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
562 nfs_fattr_init(&fattr); 562 nfs_fattr_init(&fattr);
563 desc->entry = &my_entry; 563 desc->entry = &my_entry;
564 564
565 nfs_block_sillyrename(dentry);
565 while(!desc->entry->eof) { 566 while(!desc->entry->eof) {
566 res = readdir_search_pagecache(desc); 567 res = readdir_search_pagecache(desc);
567 568
@@ -592,6 +593,7 @@ static int nfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
592 break; 593 break;
593 } 594 }
594 } 595 }
596 nfs_unblock_sillyrename(dentry);
595 unlock_kernel(); 597 unlock_kernel();
596 if (res > 0) 598 if (res > 0)
597 res = 0; 599 res = 0;
@@ -866,6 +868,7 @@ struct dentry_operations nfs_dentry_operations = {
866static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *nd) 868static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, struct nameidata *nd)
867{ 869{
868 struct dentry *res; 870 struct dentry *res;
871 struct dentry *parent;
869 struct inode *inode = NULL; 872 struct inode *inode = NULL;
870 int error; 873 int error;
871 struct nfs_fh fhandle; 874 struct nfs_fh fhandle;
@@ -894,26 +897,31 @@ static struct dentry *nfs_lookup(struct inode *dir, struct dentry * dentry, stru
894 goto out_unlock; 897 goto out_unlock;
895 } 898 }
896 899
900 parent = dentry->d_parent;
901 /* Protect against concurrent sillydeletes */
902 nfs_block_sillyrename(parent);
897 error = NFS_PROTO(dir)->lookup(dir, &dentry->d_name, &fhandle, &fattr); 903 error = NFS_PROTO(dir)->lookup(dir, &dentry->d_name, &fhandle, &fattr);
898 if (error == -ENOENT) 904 if (error == -ENOENT)
899 goto no_entry; 905 goto no_entry;
900 if (error < 0) { 906 if (error < 0) {
901 res = ERR_PTR(error); 907 res = ERR_PTR(error);
902 goto out_unlock; 908 goto out_unblock_sillyrename;
903 } 909 }
904 inode = nfs_fhget(dentry->d_sb, &fhandle, &fattr); 910 inode = nfs_fhget(dentry->d_sb, &fhandle, &fattr);
905 res = (struct dentry *)inode; 911 res = (struct dentry *)inode;
906 if (IS_ERR(res)) 912 if (IS_ERR(res))
907 goto out_unlock; 913 goto out_unblock_sillyrename;
908 914
909no_entry: 915no_entry:
910 res = d_materialise_unique(dentry, inode); 916 res = d_materialise_unique(dentry, inode);
911 if (res != NULL) { 917 if (res != NULL) {
912 if (IS_ERR(res)) 918 if (IS_ERR(res))
913 goto out_unlock; 919 goto out_unblock_sillyrename;
914 dentry = res; 920 dentry = res;
915 } 921 }
916 nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); 922 nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
923out_unblock_sillyrename:
924 nfs_unblock_sillyrename(parent);
917out_unlock: 925out_unlock:
918 unlock_kernel(); 926 unlock_kernel();
919out: 927out:
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index d29f90d00aa2..b3bb89f7d5d2 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -131,7 +131,7 @@ nfs_file_release(struct inode *inode, struct file *filp)
131{ 131{
132 /* Ensure that dirty pages are flushed out with the right creds */ 132 /* Ensure that dirty pages are flushed out with the right creds */
133 if (filp->f_mode & FMODE_WRITE) 133 if (filp->f_mode & FMODE_WRITE)
134 filemap_fdatawrite(filp->f_mapping); 134 nfs_wb_all(filp->f_path.dentry->d_inode);
135 nfs_inc_stats(inode, NFSIOS_VFSRELEASE); 135 nfs_inc_stats(inode, NFSIOS_VFSRELEASE);
136 return NFS_PROTO(inode)->file_release(inode, filp); 136 return NFS_PROTO(inode)->file_release(inode, filp);
137} 137}
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index 6d2f2a3eccf8..db5d96dc6107 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -514,7 +514,7 @@ struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx)
514 return ctx; 514 return ctx;
515} 515}
516 516
517void put_nfs_open_context(struct nfs_open_context *ctx) 517static void __put_nfs_open_context(struct nfs_open_context *ctx, int wait)
518{ 518{
519 struct inode *inode = ctx->path.dentry->d_inode; 519 struct inode *inode = ctx->path.dentry->d_inode;
520 520
@@ -522,8 +522,12 @@ void put_nfs_open_context(struct nfs_open_context *ctx)
522 return; 522 return;
523 list_del(&ctx->list); 523 list_del(&ctx->list);
524 spin_unlock(&inode->i_lock); 524 spin_unlock(&inode->i_lock);
525 if (ctx->state != NULL) 525 if (ctx->state != NULL) {
526 nfs4_close_state(&ctx->path, ctx->state, ctx->mode); 526 if (wait)
527 nfs4_close_sync(&ctx->path, ctx->state, ctx->mode);
528 else
529 nfs4_close_state(&ctx->path, ctx->state, ctx->mode);
530 }
527 if (ctx->cred != NULL) 531 if (ctx->cred != NULL)
528 put_rpccred(ctx->cred); 532 put_rpccred(ctx->cred);
529 dput(ctx->path.dentry); 533 dput(ctx->path.dentry);
@@ -531,6 +535,16 @@ void put_nfs_open_context(struct nfs_open_context *ctx)
531 kfree(ctx); 535 kfree(ctx);
532} 536}
533 537
538void put_nfs_open_context(struct nfs_open_context *ctx)
539{
540 __put_nfs_open_context(ctx, 0);
541}
542
543static void put_nfs_open_context_sync(struct nfs_open_context *ctx)
544{
545 __put_nfs_open_context(ctx, 1);
546}
547
534/* 548/*
535 * Ensure that mmap has a recent RPC credential for use when writing out 549 * Ensure that mmap has a recent RPC credential for use when writing out
536 * shared pages 550 * shared pages
@@ -577,7 +591,7 @@ static void nfs_file_clear_open_context(struct file *filp)
577 spin_lock(&inode->i_lock); 591 spin_lock(&inode->i_lock);
578 list_move_tail(&ctx->list, &NFS_I(inode)->open_files); 592 list_move_tail(&ctx->list, &NFS_I(inode)->open_files);
579 spin_unlock(&inode->i_lock); 593 spin_unlock(&inode->i_lock);
580 put_nfs_open_context(ctx); 594 put_nfs_open_context_sync(ctx);
581 } 595 }
582} 596}
583 597
@@ -1169,6 +1183,9 @@ static void init_once(struct kmem_cache * cachep, void *foo)
1169 INIT_RADIX_TREE(&nfsi->nfs_page_tree, GFP_ATOMIC); 1183 INIT_RADIX_TREE(&nfsi->nfs_page_tree, GFP_ATOMIC);
1170 nfsi->ncommit = 0; 1184 nfsi->ncommit = 0;
1171 nfsi->npages = 0; 1185 nfsi->npages = 0;
1186 atomic_set(&nfsi->silly_count, 1);
1187 INIT_HLIST_HEAD(&nfsi->silly_list);
1188 init_waitqueue_head(&nfsi->waitqueue);
1172 nfs4_init_once(nfsi); 1189 nfs4_init_once(nfsi);
1173} 1190}
1174 1191
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index d2802b1ca3b9..b35069a2aa9e 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -178,7 +178,7 @@ extern int nfs4_proc_setclientid(struct nfs_client *, u32, unsigned short, struc
178extern int nfs4_proc_setclientid_confirm(struct nfs_client *, struct rpc_cred *); 178extern int nfs4_proc_setclientid_confirm(struct nfs_client *, struct rpc_cred *);
179extern int nfs4_proc_async_renew(struct nfs_client *, struct rpc_cred *); 179extern int nfs4_proc_async_renew(struct nfs_client *, struct rpc_cred *);
180extern int nfs4_proc_renew(struct nfs_client *, struct rpc_cred *); 180extern int nfs4_proc_renew(struct nfs_client *, struct rpc_cred *);
181extern int nfs4_do_close(struct path *path, struct nfs4_state *state); 181extern int nfs4_do_close(struct path *path, struct nfs4_state *state, int wait);
182extern struct dentry *nfs4_atomic_open(struct inode *, struct dentry *, struct nameidata *); 182extern struct dentry *nfs4_atomic_open(struct inode *, struct dentry *, struct nameidata *);
183extern int nfs4_open_revalidate(struct inode *, struct dentry *, int, struct nameidata *); 183extern int nfs4_open_revalidate(struct inode *, struct dentry *, int, struct nameidata *);
184extern int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle); 184extern int nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *fhandle);
@@ -209,6 +209,7 @@ extern void nfs4_drop_state_owner(struct nfs4_state_owner *);
209extern struct nfs4_state * nfs4_get_open_state(struct inode *, struct nfs4_state_owner *); 209extern struct nfs4_state * nfs4_get_open_state(struct inode *, struct nfs4_state_owner *);
210extern void nfs4_put_open_state(struct nfs4_state *); 210extern void nfs4_put_open_state(struct nfs4_state *);
211extern void nfs4_close_state(struct path *, struct nfs4_state *, mode_t); 211extern void nfs4_close_state(struct path *, struct nfs4_state *, mode_t);
212extern void nfs4_close_sync(struct path *, struct nfs4_state *, mode_t);
212extern void nfs4_state_set_mode_locked(struct nfs4_state *, mode_t); 213extern void nfs4_state_set_mode_locked(struct nfs4_state *, mode_t);
213extern void nfs4_schedule_state_recovery(struct nfs_client *); 214extern void nfs4_schedule_state_recovery(struct nfs_client *);
214extern void nfs4_put_lock_state(struct nfs4_lock_state *lsp); 215extern void nfs4_put_lock_state(struct nfs4_lock_state *lsp);
@@ -235,6 +236,7 @@ extern struct svc_version nfs4_callback_version1;
235#else 236#else
236 237
237#define nfs4_close_state(a, b, c) do { } while (0) 238#define nfs4_close_state(a, b, c) do { } while (0)
239#define nfs4_close_sync(a, b, c) do { } while (0)
238 240
239#endif /* CONFIG_NFS_V4 */ 241#endif /* CONFIG_NFS_V4 */
240#endif /* __LINUX_FS_NFS_NFS4_FS.H */ 242#endif /* __LINUX_FS_NFS_NFS4_FS.H */
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index cb99fd90a9ac..f03d9d5f5ba4 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -1305,7 +1305,7 @@ static const struct rpc_call_ops nfs4_close_ops = {
1305 * 1305 *
1306 * NOTE: Caller must be holding the sp->so_owner semaphore! 1306 * NOTE: Caller must be holding the sp->so_owner semaphore!
1307 */ 1307 */
1308int nfs4_do_close(struct path *path, struct nfs4_state *state) 1308int nfs4_do_close(struct path *path, struct nfs4_state *state, int wait)
1309{ 1309{
1310 struct nfs_server *server = NFS_SERVER(state->inode); 1310 struct nfs_server *server = NFS_SERVER(state->inode);
1311 struct nfs4_closedata *calldata; 1311 struct nfs4_closedata *calldata;
@@ -1333,8 +1333,11 @@ int nfs4_do_close(struct path *path, struct nfs4_state *state)
1333 task = rpc_run_task(server->client, RPC_TASK_ASYNC, &nfs4_close_ops, calldata); 1333 task = rpc_run_task(server->client, RPC_TASK_ASYNC, &nfs4_close_ops, calldata);
1334 if (IS_ERR(task)) 1334 if (IS_ERR(task))
1335 return PTR_ERR(task); 1335 return PTR_ERR(task);
1336 status = 0;
1337 if (wait)
1338 status = rpc_wait_for_completion_task(task);
1336 rpc_put_task(task); 1339 rpc_put_task(task);
1337 return 0; 1340 return status;
1338out_free_calldata: 1341out_free_calldata:
1339 kfree(calldata); 1342 kfree(calldata);
1340out: 1343out:
@@ -1365,13 +1368,14 @@ static int nfs4_intent_set_file(struct nameidata *nd, struct path *path, struct
1365 } 1368 }
1366 ret = PTR_ERR(filp); 1369 ret = PTR_ERR(filp);
1367out_close: 1370out_close:
1368 nfs4_close_state(path, state, nd->intent.open.flags); 1371 nfs4_close_sync(path, state, nd->intent.open.flags);
1369 return ret; 1372 return ret;
1370} 1373}
1371 1374
1372struct dentry * 1375struct dentry *
1373nfs4_atomic_open(struct inode *dir, struct dentry *dentry, struct nameidata *nd) 1376nfs4_atomic_open(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
1374{ 1377{
1378 struct dentry *parent;
1375 struct path path = { 1379 struct path path = {
1376 .mnt = nd->mnt, 1380 .mnt = nd->mnt,
1377 .dentry = dentry, 1381 .dentry = dentry,
@@ -1394,6 +1398,9 @@ nfs4_atomic_open(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
1394 cred = rpcauth_lookupcred(NFS_CLIENT(dir)->cl_auth, 0); 1398 cred = rpcauth_lookupcred(NFS_CLIENT(dir)->cl_auth, 0);
1395 if (IS_ERR(cred)) 1399 if (IS_ERR(cred))
1396 return (struct dentry *)cred; 1400 return (struct dentry *)cred;
1401 parent = dentry->d_parent;
1402 /* Protect against concurrent sillydeletes */
1403 nfs_block_sillyrename(parent);
1397 state = nfs4_do_open(dir, &path, nd->intent.open.flags, &attr, cred); 1404 state = nfs4_do_open(dir, &path, nd->intent.open.flags, &attr, cred);
1398 put_rpccred(cred); 1405 put_rpccred(cred);
1399 if (IS_ERR(state)) { 1406 if (IS_ERR(state)) {
@@ -1401,12 +1408,14 @@ nfs4_atomic_open(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
1401 d_add(dentry, NULL); 1408 d_add(dentry, NULL);
1402 nfs_set_verifier(dentry, nfs_save_change_attribute(dir)); 1409 nfs_set_verifier(dentry, nfs_save_change_attribute(dir));
1403 } 1410 }
1411 nfs_unblock_sillyrename(parent);
1404 return (struct dentry *)state; 1412 return (struct dentry *)state;
1405 } 1413 }
1406 res = d_add_unique(dentry, igrab(state->inode)); 1414 res = d_add_unique(dentry, igrab(state->inode));
1407 if (res != NULL) 1415 if (res != NULL)
1408 path.dentry = res; 1416 path.dentry = res;
1409 nfs_set_verifier(path.dentry, nfs_save_change_attribute(dir)); 1417 nfs_set_verifier(path.dentry, nfs_save_change_attribute(dir));
1418 nfs_unblock_sillyrename(parent);
1410 nfs4_intent_set_file(nd, &path, state); 1419 nfs4_intent_set_file(nd, &path, state);
1411 return res; 1420 return res;
1412} 1421}
@@ -1444,7 +1453,7 @@ nfs4_open_revalidate(struct inode *dir, struct dentry *dentry, int openflags, st
1444 nfs4_intent_set_file(nd, &path, state); 1453 nfs4_intent_set_file(nd, &path, state);
1445 return 1; 1454 return 1;
1446 } 1455 }
1447 nfs4_close_state(&path, state, openflags); 1456 nfs4_close_sync(&path, state, openflags);
1448out_drop: 1457out_drop:
1449 d_drop(dentry); 1458 d_drop(dentry);
1450 return 0; 1459 return 0;
@@ -1898,7 +1907,7 @@ nfs4_proc_create(struct inode *dir, struct dentry *dentry, struct iattr *sattr,
1898 if (status == 0 && (nd->flags & LOOKUP_OPEN) != 0) 1907 if (status == 0 && (nd->flags & LOOKUP_OPEN) != 0)
1899 status = nfs4_intent_set_file(nd, &path, state); 1908 status = nfs4_intent_set_file(nd, &path, state);
1900 else 1909 else
1901 nfs4_close_state(&path, state, flags); 1910 nfs4_close_sync(&path, state, flags);
1902out: 1911out:
1903 return status; 1912 return status;
1904} 1913}
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index bfb36261cecb..23a9a36556bf 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -425,7 +425,7 @@ void nfs4_put_open_state(struct nfs4_state *state)
425/* 425/*
426 * Close the current file. 426 * Close the current file.
427 */ 427 */
428void nfs4_close_state(struct path *path, struct nfs4_state *state, mode_t mode) 428static void __nfs4_close(struct path *path, struct nfs4_state *state, mode_t mode, int wait)
429{ 429{
430 struct nfs4_state_owner *owner = state->owner; 430 struct nfs4_state_owner *owner = state->owner;
431 int call_close = 0; 431 int call_close = 0;
@@ -466,7 +466,17 @@ void nfs4_close_state(struct path *path, struct nfs4_state *state, mode_t mode)
466 nfs4_put_open_state(state); 466 nfs4_put_open_state(state);
467 nfs4_put_state_owner(owner); 467 nfs4_put_state_owner(owner);
468 } else 468 } else
469 nfs4_do_close(path, state); 469 nfs4_do_close(path, state, wait);
470}
471
472void nfs4_close_state(struct path *path, struct nfs4_state *state, mode_t mode)
473{
474 __nfs4_close(path, state, mode, 0);
475}
476
477void nfs4_close_sync(struct path *path, struct nfs4_state *state, mode_t mode)
478{
479 __nfs4_close(path, state, mode, 1);
470} 480}
471 481
472/* 482/*
diff --git a/fs/nfs/nfsroot.c b/fs/nfs/nfsroot.c
index e87b44ee9ac9..4b0334590ee5 100644
--- a/fs/nfs/nfsroot.c
+++ b/fs/nfs/nfsroot.c
@@ -43,7 +43,7 @@
43 * from being used (thanks to Leo Spiekman) 43 * from being used (thanks to Leo Spiekman)
44 * Andy Walker : Allow to specify the NFS server in nfs_root 44 * Andy Walker : Allow to specify the NFS server in nfs_root
45 * without giving a path name 45 * without giving a path name
46 * Swen Thümmler : Allow to specify the NFS options in nfs_root 46 * Swen Thümmler : Allow to specify the NFS options in nfs_root
47 * without giving a path name. Fix BOOTP request 47 * without giving a path name. Fix BOOTP request
48 * for domainname (domainname is NIS domain, not 48 * for domainname (domainname is NIS domain, not
49 * DNS domain!). Skip dummy devices for BOOTP. 49 * DNS domain!). Skip dummy devices for BOOTP.
diff --git a/fs/nfs/unlink.c b/fs/nfs/unlink.c
index 1aed850d18f2..ce558c2e4d53 100644
--- a/fs/nfs/unlink.c
+++ b/fs/nfs/unlink.c
@@ -11,9 +11,11 @@
11#include <linux/sunrpc/sched.h> 11#include <linux/sunrpc/sched.h>
12#include <linux/sunrpc/clnt.h> 12#include <linux/sunrpc/clnt.h>
13#include <linux/nfs_fs.h> 13#include <linux/nfs_fs.h>
14 14#include <linux/sched.h>
15#include <linux/wait.h>
15 16
16struct nfs_unlinkdata { 17struct nfs_unlinkdata {
18 struct hlist_node list;
17 struct nfs_removeargs args; 19 struct nfs_removeargs args;
18 struct nfs_removeres res; 20 struct nfs_removeres res;
19 struct inode *dir; 21 struct inode *dir;
@@ -52,6 +54,20 @@ static int nfs_copy_dname(struct dentry *dentry, struct nfs_unlinkdata *data)
52 return 0; 54 return 0;
53} 55}
54 56
57static void nfs_free_dname(struct nfs_unlinkdata *data)
58{
59 kfree(data->args.name.name);
60 data->args.name.name = NULL;
61 data->args.name.len = 0;
62}
63
64static void nfs_dec_sillycount(struct inode *dir)
65{
66 struct nfs_inode *nfsi = NFS_I(dir);
67 if (atomic_dec_return(&nfsi->silly_count) == 1)
68 wake_up(&nfsi->waitqueue);
69}
70
55/** 71/**
56 * nfs_async_unlink_init - Initialize the RPC info 72 * nfs_async_unlink_init - Initialize the RPC info
57 * task: rpc_task of the sillydelete 73 * task: rpc_task of the sillydelete
@@ -95,6 +111,8 @@ static void nfs_async_unlink_done(struct rpc_task *task, void *calldata)
95static void nfs_async_unlink_release(void *calldata) 111static void nfs_async_unlink_release(void *calldata)
96{ 112{
97 struct nfs_unlinkdata *data = calldata; 113 struct nfs_unlinkdata *data = calldata;
114
115 nfs_dec_sillycount(data->dir);
98 nfs_free_unlinkdata(data); 116 nfs_free_unlinkdata(data);
99} 117}
100 118
@@ -104,33 +122,100 @@ static const struct rpc_call_ops nfs_unlink_ops = {
104 .rpc_release = nfs_async_unlink_release, 122 .rpc_release = nfs_async_unlink_release,
105}; 123};
106 124
107static int nfs_call_unlink(struct dentry *dentry, struct nfs_unlinkdata *data) 125static int nfs_do_call_unlink(struct dentry *parent, struct inode *dir, struct nfs_unlinkdata *data)
108{ 126{
109 struct rpc_task *task; 127 struct rpc_task *task;
128 struct dentry *alias;
129
130 alias = d_lookup(parent, &data->args.name);
131 if (alias != NULL) {
132 int ret = 0;
133 /*
134 * Hey, we raced with lookup... See if we need to transfer
135 * the sillyrename information to the aliased dentry.
136 */
137 nfs_free_dname(data);
138 spin_lock(&alias->d_lock);
139 if (!(alias->d_flags & DCACHE_NFSFS_RENAMED)) {
140 alias->d_fsdata = data;
141 alias->d_flags ^= DCACHE_NFSFS_RENAMED;
142 ret = 1;
143 }
144 spin_unlock(&alias->d_lock);
145 nfs_dec_sillycount(dir);
146 dput(alias);
147 return ret;
148 }
149 data->dir = igrab(dir);
150 if (!data->dir) {
151 nfs_dec_sillycount(dir);
152 return 0;
153 }
154 data->args.fh = NFS_FH(dir);
155 nfs_fattr_init(&data->res.dir_attr);
156
157 task = rpc_run_task(NFS_CLIENT(dir), RPC_TASK_ASYNC, &nfs_unlink_ops, data);
158 if (!IS_ERR(task))
159 rpc_put_task(task);
160 return 1;
161}
162
163static int nfs_call_unlink(struct dentry *dentry, struct nfs_unlinkdata *data)
164{
110 struct dentry *parent; 165 struct dentry *parent;
111 struct inode *dir; 166 struct inode *dir;
167 int ret = 0;
112 168
113 if (nfs_copy_dname(dentry, data) < 0)
114 goto out_free;
115 169
116 parent = dget_parent(dentry); 170 parent = dget_parent(dentry);
117 if (parent == NULL) 171 if (parent == NULL)
118 goto out_free; 172 goto out_free;
119 dir = igrab(parent->d_inode); 173 dir = parent->d_inode;
174 if (nfs_copy_dname(dentry, data) == 0)
175 goto out_dput;
176 /* Non-exclusive lock protects against concurrent lookup() calls */
177 spin_lock(&dir->i_lock);
178 if (atomic_inc_not_zero(&NFS_I(dir)->silly_count) == 0) {
179 /* Deferred delete */
180 hlist_add_head(&data->list, &NFS_I(dir)->silly_list);
181 spin_unlock(&dir->i_lock);
182 ret = 1;
183 goto out_dput;
184 }
185 spin_unlock(&dir->i_lock);
186 ret = nfs_do_call_unlink(parent, dir, data);
187out_dput:
120 dput(parent); 188 dput(parent);
121 if (dir == NULL) 189out_free:
122 goto out_free; 190 return ret;
191}
123 192
124 data->dir = dir; 193void nfs_block_sillyrename(struct dentry *dentry)
125 data->args.fh = NFS_FH(dir); 194{
126 nfs_fattr_init(&data->res.dir_attr); 195 struct nfs_inode *nfsi = NFS_I(dentry->d_inode);
127 196
128 task = rpc_run_task(NFS_CLIENT(dir), RPC_TASK_ASYNC, &nfs_unlink_ops, data); 197 wait_event(nfsi->waitqueue, atomic_cmpxchg(&nfsi->silly_count, 1, 0) == 1);
129 if (!IS_ERR(task)) 198}
130 rpc_put_task(task); 199
131 return 1; 200void nfs_unblock_sillyrename(struct dentry *dentry)
132out_free: 201{
133 return 0; 202 struct inode *dir = dentry->d_inode;
203 struct nfs_inode *nfsi = NFS_I(dir);
204 struct nfs_unlinkdata *data;
205
206 atomic_inc(&nfsi->silly_count);
207 spin_lock(&dir->i_lock);
208 while (!hlist_empty(&nfsi->silly_list)) {
209 if (!atomic_inc_not_zero(&nfsi->silly_count))
210 break;
211 data = hlist_entry(nfsi->silly_list.first, struct nfs_unlinkdata, list);
212 hlist_del(&data->list);
213 spin_unlock(&dir->i_lock);
214 if (nfs_do_call_unlink(dentry, dir, data) == 0)
215 nfs_free_unlinkdata(data);
216 spin_lock(&dir->i_lock);
217 }
218 spin_unlock(&dir->i_lock);
134} 219}
135 220
136/** 221/**
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 0cf9d1cd9bd2..89527a487ed7 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -174,8 +174,6 @@ static void nfs_mark_uptodate(struct page *page, unsigned int base, unsigned int
174 return; 174 return;
175 if (count != nfs_page_length(page)) 175 if (count != nfs_page_length(page))
176 return; 176 return;
177 if (count != PAGE_CACHE_SIZE)
178 zero_user_page(page, count, PAGE_CACHE_SIZE - count, KM_USER0);
179 SetPageUptodate(page); 177 SetPageUptodate(page);
180} 178}
181 179
@@ -627,7 +625,8 @@ static struct nfs_page * nfs_update_request(struct nfs_open_context* ctx,
627 return ERR_PTR(error); 625 return ERR_PTR(error);
628 } 626 }
629 spin_unlock(&inode->i_lock); 627 spin_unlock(&inode->i_lock);
630 return new; 628 req = new;
629 goto zero_page;
631 } 630 }
632 spin_unlock(&inode->i_lock); 631 spin_unlock(&inode->i_lock);
633 632
@@ -655,13 +654,23 @@ static struct nfs_page * nfs_update_request(struct nfs_open_context* ctx,
655 if (offset < req->wb_offset) { 654 if (offset < req->wb_offset) {
656 req->wb_offset = offset; 655 req->wb_offset = offset;
657 req->wb_pgbase = offset; 656 req->wb_pgbase = offset;
658 req->wb_bytes = rqend - req->wb_offset; 657 req->wb_bytes = max(end, rqend) - req->wb_offset;
658 goto zero_page;
659 } 659 }
660 660
661 if (end > rqend) 661 if (end > rqend)
662 req->wb_bytes = end - req->wb_offset; 662 req->wb_bytes = end - req->wb_offset;
663 663
664 return req; 664 return req;
665zero_page:
666 /* If this page might potentially be marked as up to date,
667 * then we need to zero any uninitalised data. */
668 if (req->wb_pgbase == 0 && req->wb_bytes != PAGE_CACHE_SIZE
669 && !PageUptodate(req->wb_page))
670 zero_user_page(req->wb_page, req->wb_bytes,
671 PAGE_CACHE_SIZE - req->wb_bytes,
672 KM_USER0);
673 return req;
665} 674}
666 675
667int nfs_flush_incompatible(struct file *file, struct page *page) 676int nfs_flush_incompatible(struct file *file, struct page *page)
diff --git a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog
index 345798ebd366..37c11e194372 100644
--- a/fs/ntfs/ChangeLog
+++ b/fs/ntfs/ChangeLog
@@ -382,7 +382,7 @@ ToDo/Notes:
382 own locking so it does not matter if the vfs inode is locked. 382 own locking so it does not matter if the vfs inode is locked.
383 - Fix bug in mft record writing where we forgot to set the device in 383 - Fix bug in mft record writing where we forgot to set the device in
384 the buffers when mapping them after the VM had discarded them. 384 the buffers when mapping them after the VM had discarded them.
385 Thanks to Martin MOKREJÅ  for the bug report. 385 Thanks to Martin MOKREJÃ… for the bug report.
386 386
3872.1.22 - Many bug and race fixes and error handling improvements. 3872.1.22 - Many bug and race fixes and error handling improvements.
388 388
@@ -1585,7 +1585,7 @@ tng-0.0.4 - Big changes, getting in line with Al Viro's comments.
1585 for reading $MFT (ntfs_mft_readpage). In the process create dedicated 1585 for reading $MFT (ntfs_mft_readpage). In the process create dedicated
1586 address space operations (ntfs_mft_aops) for $MFT inode mapping. Also 1586 address space operations (ntfs_mft_aops) for $MFT inode mapping. Also
1587 removed the now superfluous exports from the kernel core patch. 1587 removed the now superfluous exports from the kernel core patch.
1588 - Fix a bug where kfree() was used insted of ntfs_free(). 1588 - Fix a bug where kfree() was used instead of ntfs_free().
1589 - Change map_mft_record() to take ntfs_inode as argument instead of 1589 - Change map_mft_record() to take ntfs_inode as argument instead of
1590 vfs inode. Dito for unmap_mft_record(). Adapt all callers. 1590 vfs inode. Dito for unmap_mft_record(). Adapt all callers.
1591 - Add pointer to ntfs_volume to ntfs_inode. 1591 - Add pointer to ntfs_volume to ntfs_inode.
diff --git a/fs/ntfs/sysctl.c b/fs/ntfs/sysctl.c
index 4847fbfb0107..9ef85e628fe1 100644
--- a/fs/ntfs/sysctl.c
+++ b/fs/ntfs/sysctl.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * sysctl.c - Code for sysctl handling in NTFS Linux kernel driver. Part of 2 * sysctl.c - Code for sysctl handling in NTFS Linux kernel driver. Part of
3 * the Linux-NTFS project. Adapted from the old NTFS driver, 3 * the Linux-NTFS project. Adapted from the old NTFS driver,
4 * Copyright (C) 1997 Martin von Löwis, Régis Duchesne 4 * Copyright (C) 1997 Martin von Löwis, Régis Duchesne
5 * 5 *
6 * Copyright (c) 2002-2005 Anton Altaparmakov 6 * Copyright (c) 2002-2005 Anton Altaparmakov
7 * 7 *
diff --git a/fs/ntfs/sysctl.h b/fs/ntfs/sysctl.h
index beda5bf96405..d4f8ce920d95 100644
--- a/fs/ntfs/sysctl.h
+++ b/fs/ntfs/sysctl.h
@@ -1,7 +1,7 @@
1/* 1/*
2 * sysctl.h - Defines for sysctl handling in NTFS Linux kernel driver. Part of 2 * sysctl.h - Defines for sysctl handling in NTFS Linux kernel driver. Part of
3 * the Linux-NTFS project. Adapted from the old NTFS driver, 3 * the Linux-NTFS project. Adapted from the old NTFS driver,
4 * Copyright (C) 1997 Martin von Löwis, Régis Duchesne 4 * Copyright (C) 1997 Martin von Löwis, Régis Duchesne
5 * 5 *
6 * Copyright (c) 2002-2004 Anton Altaparmakov 6 * Copyright (c) 2002-2004 Anton Altaparmakov
7 * 7 *
diff --git a/fs/ocfs2/dcache.c b/fs/ocfs2/dcache.c
index 014e73978dac..3094ddb7a254 100644
--- a/fs/ocfs2/dcache.c
+++ b/fs/ocfs2/dcache.c
@@ -376,7 +376,7 @@ out:
376 * directory locks. The dentries have already been deleted on other 376 * directory locks. The dentries have already been deleted on other
377 * nodes via ocfs2_remote_dentry_delete(). 377 * nodes via ocfs2_remote_dentry_delete().
378 * 378 *
379 * Normally, the VFS handles the d_move() for the file sytem, after 379 * Normally, the VFS handles the d_move() for the file system, after
380 * the ->rename() callback. OCFS2 wants to handle this internally, so 380 * the ->rename() callback. OCFS2 wants to handle this internally, so
381 * the new lock can be created atomically with respect to the cluster. 381 * the new lock can be created atomically with respect to the cluster.
382 */ 382 */
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c
index 57adfe90d5ae..98c3781bc069 100644
--- a/fs/reiserfs/super.c
+++ b/fs/reiserfs/super.c
@@ -319,7 +319,7 @@ static int finish_unfinished(struct super_block *s)
319 319
320/* to protect file being unlinked from getting lost we "safe" link files 320/* to protect file being unlinked from getting lost we "safe" link files
321 being unlinked. This link will be deleted in the same transaction with last 321 being unlinked. This link will be deleted in the same transaction with last
322 item of file. mounting the filesytem we scan all these links and remove 322 item of file. mounting the filesystem we scan all these links and remove
323 files which almost got lost */ 323 files which almost got lost */
324void add_save_link(struct reiserfs_transaction_handle *th, 324void add_save_link(struct reiserfs_transaction_handle *th,
325 struct inode *inode, int truncate) 325 struct inode *inode, int truncate)
diff --git a/fs/super.c b/fs/super.c
index d28fde7e1cfb..ceaf2e3d594c 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -15,7 +15,7 @@
15 * Added kerneld support: Jacques Gelinas and Bjorn Ekwall 15 * Added kerneld support: Jacques Gelinas and Bjorn Ekwall
16 * Added change_root: Werner Almesberger & Hans Lermen, Feb '96 16 * Added change_root: Werner Almesberger & Hans Lermen, Feb '96
17 * Added options to /proc/mounts: 17 * Added options to /proc/mounts:
18 * Torbjörn Lindh (torbjorn.lindh@gopta.se), April 14, 1996. 18 * Torbjörn Lindh (torbjorn.lindh@gopta.se), April 14, 1996.
19 * Added devfs support: Richard Gooch <rgooch@atnf.csiro.au>, 13-JAN-1998 19 * Added devfs support: Richard Gooch <rgooch@atnf.csiro.au>, 13-JAN-1998
20 * Heavily rewritten for 'one fs - one tree' dcache architecture. AV, Mar 2000 20 * Heavily rewritten for 'one fs - one tree' dcache architecture. AV, Mar 2000
21 */ 21 */
@@ -417,7 +417,7 @@ restart:
417} 417}
418 418
419/* 419/*
420 * Call the ->sync_fs super_op against all filesytems which are r/w and 420 * Call the ->sync_fs super_op against all filesystems which are r/w and
421 * which implement it. 421 * which implement it.
422 * 422 *
423 * This operation is careful to avoid the livelock which could easily happen 423 * This operation is careful to avoid the livelock which could easily happen
@@ -425,7 +425,7 @@ restart:
425 * is used only here. We set it against all filesystems and then clear it as 425 * is used only here. We set it against all filesystems and then clear it as
426 * we sync them. So redirtied filesystems are skipped. 426 * we sync them. So redirtied filesystems are skipped.
427 * 427 *
428 * But if process A is currently running sync_filesytems and then process B 428 * But if process A is currently running sync_filesystems and then process B
429 * calls sync_filesystems as well, process B will set all the s_need_sync_fs 429 * calls sync_filesystems as well, process B will set all the s_need_sync_fs
430 * flags again, which will cause process A to resync everything. Fix that with 430 * flags again, which will cause process A to resync everything. Fix that with
431 * a local mutex. 431 * a local mutex.
diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index d3be1e7fb48b..27d1785b7644 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -540,7 +540,7 @@ int sysfs_add_file(struct sysfs_dirent *dir_sd, const struct attribute *attr,
540/** 540/**
541 * sysfs_create_file - create an attribute file for an object. 541 * sysfs_create_file - create an attribute file for an object.
542 * @kobj: object we're creating for. 542 * @kobj: object we're creating for.
543 * @attr: atrribute descriptor. 543 * @attr: attribute descriptor.
544 */ 544 */
545 545
546int sysfs_create_file(struct kobject * kobj, const struct attribute * attr) 546int sysfs_create_file(struct kobject * kobj, const struct attribute * attr)