public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: linux-kernel@vger.kernel.org
Cc: nfs@lists.sourceforge.net, Neil Brown <neilb@suse.de>,
	Christoph Hellwig <hch@infradead.org>,
	Christoph Hellwig <hch@lst.de>
Subject: [PATCH 03/15] nfsd: fix horrible indentation in nfsd_setattr
Date: Mon, 27 Aug 2007 16:22:44 -0400	[thread overview]
Message-ID: <1188246177833-git-send-email-bfields@fieldses.org> (raw)
In-Reply-To: <1188246176897-git-send-email-bfields@fieldses.org>

From: Christoph Hellwig <hch@infradead.org>

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 fs/nfsd/vfs.c |   43 ++++++++++++++++++++++++++-----------------
 1 files changed, 26 insertions(+), 17 deletions(-)

diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index a0c2b25..11ae949 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -294,7 +294,8 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
 	if (!iap->ia_valid)
 		goto out;
 
-	/* NFSv2 does not differentiate between "set-[ac]time-to-now"
+	/*
+	 * NFSv2 does not differentiate between "set-[ac]time-to-now"
 	 * which only requires access, and "set-[ac]time-to-X" which
 	 * requires ownership.
 	 * So if it looks like it might be "set both to the same time which
@@ -307,25 +308,33 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap,
 	 */
 #define BOTH_TIME_SET (ATTR_ATIME_SET | ATTR_MTIME_SET)
 #define	MAX_TOUCH_TIME_ERROR (30*60)
-	if ((iap->ia_valid & BOTH_TIME_SET) == BOTH_TIME_SET
-	    && iap->ia_mtime.tv_sec == iap->ia_atime.tv_sec
-	    ) {
-	    /* Looks probable.  Now just make sure time is in the right ballpark.
-	     * Solaris, at least, doesn't seem to care what the time request is.
-	     * We require it be within 30 minutes of now.
-	     */
-	    time_t delta = iap->ia_atime.tv_sec - get_seconds();
-	    if (delta<0) delta = -delta;
-	    if (delta < MAX_TOUCH_TIME_ERROR &&
-		inode_change_ok(inode, iap) != 0) {
-		/* turn off ATTR_[AM]TIME_SET but leave ATTR_[AM]TIME
-		 * this will cause notify_change to set these times to "now"
+	if ((iap->ia_valid & BOTH_TIME_SET) == BOTH_TIME_SET &&
+	    iap->ia_mtime.tv_sec == iap->ia_atime.tv_sec) {
+		/*
+		 * Looks probable.
+		 *
+		 * Now just make sure time is in the right ballpark.
+		 * Solaris, at least, doesn't seem to care what the time
+		 * request is.  We require it be within 30 minutes of now.
 		 */
-		iap->ia_valid &= ~BOTH_TIME_SET;
-	    }
+		time_t delta = iap->ia_atime.tv_sec - get_seconds();
+		if (delta < 0)
+			delta = -delta;
+		if (delta < MAX_TOUCH_TIME_ERROR &&
+		    inode_change_ok(inode, iap) != 0) {
+			/*
+			 * Turn off ATTR_[AM]TIME_SET but leave ATTR_[AM]TIME.
+			 * This will cause notify_change to set these times
+			 * to "now"
+			 */
+			iap->ia_valid &= ~BOTH_TIME_SET;
+		}
 	}
 	    
-	/* The size case is special. It changes the file as well as the attributes.  */
+	/*
+	 * The size case is special.
+	 * It changes the file as well as the attributes.
+	 */
 	if (iap->ia_valid & ATTR_SIZE) {
 		if (iap->ia_size < inode->i_size) {
 			err = nfsd_permission(rqstp, fhp->fh_export, dentry, MAY_TRUNC|MAY_OWNER_OVERRIDE);
-- 
1.5.3.rc5.19.g0734d


  reply	other threads:[~2007-08-27 20:28 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-27 20:22 nfs server patches for review J. Bruce Fields
2007-08-27 20:22 ` [PATCH 01/15] nfsd: tone down inaccurate dprintk J. Bruce Fields
2007-08-27 20:22   ` [PATCH 02/15] nfsd: remove unused cache_for_each macro J. Bruce Fields
2007-08-27 20:22     ` J. Bruce Fields [this message]
2007-08-27 20:22       ` [PATCH 04/15] knfsd: delete code made redundant by map_new_errors J. Bruce Fields
2007-08-27 20:22         ` [PATCH 05/15] knfsd: cleanup of nfsd4 cmp_* functions J. Bruce Fields
2007-08-27 20:22           ` [PATCH 06/15] knfsd: demote some printk()s to dprintk()s J. Bruce Fields
2007-08-27 20:22             ` [PATCH 07/15] knfsd: nfs4 name->id mapping not correctly parsing negative downcall J. Bruce Fields
2007-08-27 20:22               ` [PATCH 08/15] knfsd: spawn kernel thread to probe callback channel J. Bruce Fields
2007-08-27 20:22                 ` [PATCH 09/15] knfsd: move nfsv4 slab creation/destruction to module init/exit J. Bruce Fields
2007-08-27 20:22                   ` [PATCH 10/15] knfsd: Validate filehandle type in fsid_source J. Bruce Fields
2007-08-27 20:22                     ` [PATCH 11/15] knfsd: fix callback rpc cred J. Bruce Fields
2007-08-27 20:22                       ` [PATCH 12/15] nfsd warning fix J. Bruce Fields
2007-08-27 20:22                         ` [PATCH 13/15] knfsd: remove code duplication in nfsd4_setclientid() J. Bruce Fields
2007-08-27 20:22                           ` [PATCH 14/15] svcgss: move init code into separate function J. Bruce Fields
2007-08-27 20:22                             ` [PATCH 15/15] knfsd: 64 bit ino support for NFS server J. Bruce Fields
2007-08-27 23:26                 ` [PATCH 08/15] knfsd: spawn kernel thread to probe callback channel Neil Brown
2007-08-27 23:36                   ` J. Bruce Fields

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=1188246177833-git-send-email-bfields@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=hch@infradead.org \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neilb@suse.de \
    --cc=nfs@lists.sourceforge.net \
    /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