From: Miklos Szeredi <mszeredi@suse.cz>
Extract common code into a function.
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
CC: "J. Bruce Fields" <bfields@fieldses.org>
CC: Matthew Wilcox <matthew@wil.cx>
---
fs/locks.c | 71 ++++++++++++++++++++++++++-----------------------------------
1 file changed, 31 insertions(+), 40 deletions(-)
Index: linux-2.6/fs/locks.c
===================================================================
--- linux-2.6.orig/fs/locks.c 2008-05-09 14:04:46.000000000 +0200
+++ linux-2.6/fs/locks.c 2008-05-09 14:04:47.000000000 +0200
@@ -1744,6 +1744,35 @@ int vfs_lock_file(struct file *filp, uns
}
EXPORT_SYMBOL_GPL(vfs_lock_file);
+static int do_lock_file_wait(struct file *filp, unsigned int cmd,
+ struct file_lock *fl)
+{
+ int error;
+
+ error = security_file_lock(filp, fl->fl_type);
+ if (error)
+ return error;
+
+ if (filp->f_op && filp->f_op->lock != NULL)
+ error = filp->f_op->lock(filp, cmd, fl);
+ else {
+ for (;;) {
+ error = posix_lock_file(filp, fl, NULL);
+ if (error != FILE_LOCK_DEFERRED)
+ break;
+ error = wait_event_interruptible(fl->fl_wait,
+ !fl->fl_next);
+ if (!error)
+ continue;
+
+ locks_delete_block(fl);
+ break;
+ }
+ }
+
+ return error;
+}
+
/* Apply the lock described by l to an open file descriptor.
* This implements both the F_SETLK and F_SETLKW commands of fcntl().
*/
@@ -1801,26 +1830,7 @@ again:
goto out;
}
- error = security_file_lock(filp, file_lock->fl_type);
- if (error)
- goto out;
-
- if (filp->f_op && filp->f_op->lock != NULL)
- error = filp->f_op->lock(filp, cmd, file_lock);
- else {
- for (;;) {
- error = posix_lock_file(filp, file_lock, NULL);
- if (error != FILE_LOCK_DEFERRED)
- break;
- error = wait_event_interruptible(file_lock->fl_wait,
- !file_lock->fl_next);
- if (!error)
- continue;
-
- locks_delete_block(file_lock);
- break;
- }
- }
+ error = do_lock_file_wait(filp, cmd, file_lock);
/*
* Attempt to detect a close/fcntl race and recover by
@@ -1938,26 +1948,7 @@ again:
goto out;
}
- error = security_file_lock(filp, file_lock->fl_type);
- if (error)
- goto out;
-
- if (filp->f_op && filp->f_op->lock != NULL)
- error = filp->f_op->lock(filp, cmd, file_lock);
- else {
- for (;;) {
- error = posix_lock_file(filp, file_lock, NULL);
- if (error != FILE_LOCK_DEFERRED)
- break;
- error = wait_event_interruptible(file_lock->fl_wait,
- !file_lock->fl_next);
- if (!error)
- continue;
-
- locks_delete_block(file_lock);
- break;
- }
- }
+ error = do_lock_file_wait(filp, cmd, file_lock);
/*
* Attempt to detect a close/fcntl race and recover by
--
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
| Kristen Carlson Accardi | [PATCH] ata: ahci: power off unused ports |
| Gabriel C | Re: 2.6.22-rc4-mm1 |
| Jeremy Fitzhardinge | [PATCH 12 of 36] x86_64: replace end_pfn with num_physpages |
| Kyle McMartin | Re: -mm merge plans for 2.6.21 |
git: | |
| Andy Parkins | svn:externals using git submodules |
| Marius Storm-Olsen | Re: Git on MSys (or how to make it easy for Windows users to compile git) |
| Alex Riesen | Re: git-fast-import |
| rene.scharfe | Re: [PATCH 1/6] Add strbuf_rtrim and strbuf_insert. |
| Richard Stallman | Real men don't attack straw men |
| Tanvir | Re: Adobe Flash on OpenBSD |
| Will Maier | cron doesn't run commands in /etc/crontab? |
| Paul Taulborg | SMP Support? |
| David Willmore | Re: Intel, the Pentium and Linux |
| Stephen Pierce | SLS |
| Ari Lemmke | find-1.2 |
| Brett McCoy | Re: Offical windows |
| magical mounts | 7 hours ago | Linux kernel |
| Problem in scim in Fedora 9 | 8 hours ago | Linux general |
| The new Western Digital power saving drives | 8 hours ago | Hardware |
| Battery Maximizer Software | 1 day ago | Linux kernel |
| windows folder creation surprise | 1 day ago | Windows |
| Firewall | 1 day ago | OpenBSD |
| IP layer send packet | 2 days ago | Linux kernel |
| dtrace for linux available | 2 days ago | Linux kernel |
| Unable to mount ramdisk image using UBoot while upgrading to 2.6.15 kernel for a MPC8540 based target | 3 days ago | Linux kernel |
| RealTek RTL8169 - can't connect | 3 days ago | NetBSD |
