stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	stable@vger.kernel.org, Mikulas Patocka <mpatocka@redhat.com>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: [PATCH 3.10 20/20] hpfs: update ctime and mtime on directory modification
Date: Sat, 19 Sep 2015 10:27:35 -0700	[thread overview]
Message-ID: <20150919171738.904595223@linuxfoundation.org> (raw)
In-Reply-To: <20150919171737.461560711@linuxfoundation.org>

3.10-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Mikulas Patocka <mikulas@twibright.com>

commit f49a26e7718dd30b49e3541e3e25aecf5e7294e2 upstream.

Update ctime and mtime when a directory is modified. (though OS/2 doesn't
update them anyway)

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/hpfs/namei.c |   25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

--- a/fs/hpfs/namei.c
+++ b/fs/hpfs/namei.c
@@ -8,6 +8,17 @@
 #include <linux/sched.h>
 #include "hpfs_fn.h"
 
+static void hpfs_update_directory_times(struct inode *dir)
+{
+	time_t t = get_seconds();
+	if (t == dir->i_mtime.tv_sec &&
+	    t == dir->i_ctime.tv_sec)
+		return;
+	dir->i_mtime.tv_sec = dir->i_ctime.tv_sec = t;
+	dir->i_mtime.tv_nsec = dir->i_ctime.tv_nsec = 0;
+	hpfs_write_inode_nolock(dir);
+}
+
 static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
 {
 	const unsigned char *name = dentry->d_name.name;
@@ -99,6 +110,7 @@ static int hpfs_mkdir(struct inode *dir,
 		result->i_mode = mode | S_IFDIR;
 		hpfs_write_inode_nolock(result);
 	}
+	hpfs_update_directory_times(dir);
 	d_instantiate(dentry, result);
 	hpfs_unlock(dir->i_sb);
 	return 0;
@@ -187,6 +199,7 @@ static int hpfs_create(struct inode *dir
 		result->i_mode = mode | S_IFREG;
 		hpfs_write_inode_nolock(result);
 	}
+	hpfs_update_directory_times(dir);
 	d_instantiate(dentry, result);
 	hpfs_unlock(dir->i_sb);
 	return 0;
@@ -262,6 +275,7 @@ static int hpfs_mknod(struct inode *dir,
 	insert_inode_hash(result);
 
 	hpfs_write_inode_nolock(result);
+	hpfs_update_directory_times(dir);
 	d_instantiate(dentry, result);
 	brelse(bh);
 	hpfs_unlock(dir->i_sb);
@@ -340,6 +354,7 @@ static int hpfs_symlink(struct inode *di
 	insert_inode_hash(result);
 
 	hpfs_write_inode_nolock(result);
+	hpfs_update_directory_times(dir);
 	d_instantiate(dentry, result);
 	hpfs_unlock(dir->i_sb);
 	return 0;
@@ -423,6 +438,8 @@ again:
 out1:
 	hpfs_brelse4(&qbh);
 out:
+	if (!err)
+		hpfs_update_directory_times(dir);
 	hpfs_unlock(dir->i_sb);
 	return err;
 }
@@ -477,6 +494,8 @@ static int hpfs_rmdir(struct inode *dir,
 out1:
 	hpfs_brelse4(&qbh);
 out:
+	if (!err)
+		hpfs_update_directory_times(dir);
 	hpfs_unlock(dir->i_sb);
 	return err;
 }
@@ -595,7 +614,7 @@ static int hpfs_rename(struct inode *old
 		goto end1;
 	}
 
-	end:
+end:
 	hpfs_i(i)->i_parent_dir = new_dir->i_ino;
 	if (S_ISDIR(i->i_mode)) {
 		inc_nlink(new_dir);
@@ -610,6 +629,10 @@ static int hpfs_rename(struct inode *old
 		brelse(bh);
 	}
 end1:
+	if (!err) {
+		hpfs_update_directory_times(old_dir);
+		hpfs_update_directory_times(new_dir);
+	}
 	hpfs_unlock(i->i_sb);
 	return err;
 }



  parent reply	other threads:[~2015-09-19 17:27 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-19 17:27 [PATCH 3.10 00/20] 3.10.89-stable review Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.10 01/20] DRM - radeon: Dont link train DisplayPort on HPD until we get the dpcd Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.10 02/20] iio: bmg160: IIO_BUFFER and IIO_TRIGGERED_BUFFER are required Greg Kroah-Hartman
2015-09-22 22:30   ` Luis Henriques
2015-09-24  6:22     ` Markus Pargmann
2015-09-19 17:27 ` [PATCH 3.10 03/20] iio: Add inverse unit conversion macros Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.10 04/20] iio: adis16480: Fix scale factors Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.10 05/20] clk: versatile: off by one in clk_sp810_timerclken_of_get() Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.10 06/20] PCI: Fix TI816X class code quirk Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.10 07/20] USB: symbolserial: Use usb_get_serial_port_data Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.10 08/20] USB: ftdi_sio: Added custom PID for CustomWare products Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.10 09/20] usb: dwc3: ep0: Fix mem corruption on OUT transfers of more than 512 bytes Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.10 10/20] usb: host: ehci-sys: delete useless bus_to_hcd conversion Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.10 11/20] serial: 8250: dont bind to SMSC IrCC IR port Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.10 12/20] crypto: ghash-clmulni: specify context size for ghash async algorithm Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.10 13/20] HID: usbhid: Fix the check for HID_RESET_PENDING in hid_io_error Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.10 14/20] xtensa: fix threadptr reload on return to userspace Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.10 15/20] xtensa: fix kernel register spilling Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.10 16/20] devres: fix devres_get() Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.10 17/20] auxdisplay: ks0108: fix refcount Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.10 18/20] of/address: Dont loop forever in of_find_matching_node_by_address() Greg Kroah-Hartman
2015-09-19 17:27 ` [PATCH 3.10 19/20] drivercore: Fix unregistration path of platform devices Greg Kroah-Hartman
2015-09-19 17:27 ` Greg Kroah-Hartman [this message]
2015-09-20  0:17 ` [PATCH 3.10 00/20] 3.10.89-stable review Guenter Roeck
2015-09-20  8:53 ` Sudip Mukherjee
2015-09-20 16:05   ` Guenter Roeck
2015-09-21  1:44     ` Greg Kroah-Hartman
2015-09-21  8:33 ` Sudip Mukherjee
2015-09-21 16:23 ` Shuah Khan

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=20150919171738.904595223@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpatocka@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /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;
as well as URLs for NNTP newsgroup(s).