aboutsummaryrefslogtreecommitdiffstats
path: root/fs/sysfs/dir.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/sysfs/dir.c')
-rw-r--r--fs/sysfs/dir.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index 9ee130be03be..36ee6d817956 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -464,6 +464,8 @@ void sysfs_addrm_start(struct sysfs_addrm_cxt *acxt,
464 */ 464 */
465int __sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd) 465int __sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd)
466{ 466{
467 struct sysfs_inode_attrs *ps_iattr;
468
467 if (sysfs_find_dirent(acxt->parent_sd, sd->s_name)) 469 if (sysfs_find_dirent(acxt->parent_sd, sd->s_name))
468 return -EEXIST; 470 return -EEXIST;
469 471
@@ -476,6 +478,13 @@ int __sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd)
476 478
477 sysfs_link_sibling(sd); 479 sysfs_link_sibling(sd);
478 480
481 /* Update timestamps on the parent */
482 ps_iattr = acxt->parent_sd->s_iattr;
483 if (ps_iattr) {
484 struct iattr *ps_iattrs = &ps_iattr->ia_iattr;
485 ps_iattrs->ia_ctime = ps_iattrs->ia_mtime = CURRENT_TIME;
486 }
487
479 return 0; 488 return 0;
480} 489}
481 490
@@ -554,10 +563,19 @@ int sysfs_add_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd)
554 */ 563 */
555void sysfs_remove_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd) 564void sysfs_remove_one(struct sysfs_addrm_cxt *acxt, struct sysfs_dirent *sd)
556{ 565{
566 struct sysfs_inode_attrs *ps_iattr;
567
557 BUG_ON(sd->s_flags & SYSFS_FLAG_REMOVED); 568 BUG_ON(sd->s_flags & SYSFS_FLAG_REMOVED);
558 569
559 sysfs_unlink_sibling(sd); 570 sysfs_unlink_sibling(sd);
560 571
572 /* Update timestamps on the parent */
573 ps_iattr = acxt->parent_sd->s_iattr;
574 if (ps_iattr) {
575 struct iattr *ps_iattrs = &ps_iattr->ia_iattr;
576 ps_iattrs->ia_ctime = ps_iattrs->ia_mtime = CURRENT_TIME;
577 }
578
561 sd->s_flags |= SYSFS_FLAG_REMOVED; 579 sd->s_flags |= SYSFS_FLAG_REMOVED;
562 sd->s_sibling = acxt->removed; 580 sd->s_sibling = acxt->removed;
563 acxt->removed = sd; 581 acxt->removed = sd;