mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@debian.org>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>, linux-kernel@vger.kernel.org
Subject: [PATCH] fs/locks.c and fs/nfs/file.c cleanup
Date: Sun, 9 Jun 2002 17:42:56 +0100	[thread overview]
Message-ID: <20020609174256.V27186@parcelfarce.linux.theplanet.co.uk> (raw)


Thanks for applying the last series of patches.  Here's a new one,
all cleanup:

 - Inline locks_notify_blocked.
 - Remove a couple of now-bogus comments.
 - Remove the obsolete F_SHLCK and F_EXLCK cases.
 - Remove the last remaining reference to FL_BROKEN.

diff -urNX dontdiff linux-2.5.21/fs/locks.c linux-2.5.21-flock/fs/locks.c
--- linux-2.5.21/fs/locks.c	Sun Jun  9 06:09:49 2002
+++ linux-2.5.21-flock/fs/locks.c	Sun Jun  9 08:14:27 2002
@@ -443,15 +446,6 @@
 	list_add(&waiter->fl_link, &blocked_list);
 }
 
-static inline
-void locks_notify_blocked(struct file_lock *waiter)
-{
-	if (waiter->fl_notify)
-		waiter->fl_notify(waiter);
-	else
-		wake_up(&waiter->fl_wait);
-}
-
 /* Wake up processes blocked waiting for blocker.
  * If told to wait then schedule the processes until the block list
  * is empty, otherwise empty the block list ourselves.
@@ -459,12 +453,13 @@
 static void locks_wake_up_blocks(struct file_lock *blocker)
 {
 	while (!list_empty(&blocker->fl_block)) {
-		struct file_lock *waiter = list_entry(blocker->fl_block.next, struct file_lock, fl_block);
-		/* Remove waiter from the block list, because by the
-		 * time it wakes up blocker won't exist any more.
-		 */
+		struct file_lock *waiter = list_entry(blocker->fl_block.next,
+				struct file_lock, fl_block);
 		locks_delete_block(waiter);
-		locks_notify_blocked(waiter);
+		if (waiter->fl_notify)
+			waiter->fl_notify(waiter);
+		else
+			wake_up(&waiter->fl_wait);
 	}
 }
 
@@ -1405,8 +1408,6 @@
 	if (copy_from_user(&flock, l, sizeof(flock)))
 		goto out;
 
-	/* Get arguments and validate them ...
-	 */
 	inode = filp->f_dentry->d_inode;
 
 	/* Don't allow mandatory locks on files that may be memory mapped
@@ -1438,23 +1439,6 @@
 		break;
 	case F_UNLCK:
 		break;
-	case F_SHLCK:
-	case F_EXLCK:
-#ifdef __sparc__
-/* warn a bit for now, but don't overdo it */
-{
-	static int count = 0;
-	if (!count) {
-		count=1;
-		printk(KERN_WARNING
-		       "fcntl_setlk() called by process %d (%s) with broken flock() emulation\n",
-		       current->pid, current->comm);
-	}
-}
-		if (!(filp->f_mode & 3))
-			goto out;
-		break;
-#endif
 	default:
 		error = -EINVAL;
 		goto out;
@@ -1543,8 +1527,6 @@
 	if (copy_from_user(&flock, l, sizeof(flock)))
 		goto out;
 
-	/* Get arguments and validate them ...
-	 */
 	inode = filp->f_dentry->d_inode;
 
 	/* Don't allow mandatory locks on files that may be memory mapped
@@ -1576,8 +1558,6 @@
 		break;
 	case F_UNLCK:
 		break;
-	case F_SHLCK:
-	case F_EXLCK:
 	default:
 		error = -EINVAL;
 		goto out;
diff -urNX dontdiff linux-2.5.21/fs/nfs/file.c linux-2.5.21-flock/fs/nfs/file.c
--- linux-2.5.21/fs/nfs/file.c	Sun Jun  2 18:44:51 2002
+++ linux-2.5.21-flock/fs/nfs/file.c	Fri Jun  7 06:19:22 2002
@@ -272,7 +272,7 @@
 	 * Not sure whether that would be unique, though, or whether
 	 * that would break in other places.
 	 */
-	if (!fl->fl_owner || (fl->fl_flags & (FL_POSIX|FL_BROKEN)) != FL_POSIX)
+	if (!fl->fl_owner || (fl->fl_flags & FL_POSIX) != FL_POSIX)
 		return -ENOLCK;
 
 	/*

-- 
Revolutions do not require corporate support.

                 reply	other threads:[~2002-06-09 16:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020609174256.V27186@parcelfarce.linux.theplanet.co.uk \
    --to=willy@debian.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®