~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/fs/jfs/jfs_umount.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /fs/jfs/jfs_umount.c (Version linux-6.11.5) and /fs/jfs/jfs_umount.c (Version linux-2.6.0)


  1 // SPDX-License-Identifier: GPL-2.0-or-later   << 
  2 /*                                                  1 /*
  3  *   Copyright (C) International Business Mach !!   2  *   Copyright (c) International Business Machines Corp., 2000-2002
                                                   >>   3  *
                                                   >>   4  *   This program is free software;  you can redistribute it and/or modify
                                                   >>   5  *   it under the terms of the GNU General Public License as published by
                                                   >>   6  *   the Free Software Foundation; either version 2 of the License, or 
                                                   >>   7  *   (at your option) any later version.
                                                   >>   8  * 
                                                   >>   9  *   This program is distributed in the hope that it will be useful,
                                                   >>  10  *   but WITHOUT ANY WARRANTY;  without even the implied warranty of
                                                   >>  11  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
                                                   >>  12  *   the GNU General Public License for more details.
                                                   >>  13  *
                                                   >>  14  *   You should have received a copy of the GNU General Public License
                                                   >>  15  *   along with this program;  if not, write to the Free Software 
                                                   >>  16  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  4  */                                                17  */
  5                                                    18 
  6 /*                                                 19 /*
  7  *      jfs_umount.c                               20  *      jfs_umount.c
  8  *                                                 21  *
  9  * note: file system in transition to aggregat     22  * note: file system in transition to aggregate/fileset:
 10  * (ref. jfs_mount.c)                              23  * (ref. jfs_mount.c)
 11  *                                                 24  *
 12  * file system unmount is interpreted as mount !!  25  * file system unmount is interpreted as mount of the single/only 
 13  * fileset in the aggregate and, if unmount of !!  26  * fileset in the aggregate and, if unmount of the last fileset, 
 14  * as unmount of the aggerate;                     27  * as unmount of the aggerate;
 15  */                                                28  */
 16                                                    29 
 17 #include <linux/fs.h>                              30 #include <linux/fs.h>
 18 #include "jfs_incore.h"                            31 #include "jfs_incore.h"
 19 #include "jfs_filsys.h"                            32 #include "jfs_filsys.h"
 20 #include "jfs_superblock.h"                        33 #include "jfs_superblock.h"
 21 #include "jfs_dmap.h"                              34 #include "jfs_dmap.h"
 22 #include "jfs_imap.h"                              35 #include "jfs_imap.h"
 23 #include "jfs_metapage.h"                          36 #include "jfs_metapage.h"
 24 #include "jfs_debug.h"                             37 #include "jfs_debug.h"
 25                                                    38 
 26 /*                                                 39 /*
 27  * NAME:        jfs_umount(vfsp, flags, crp)       40  * NAME:        jfs_umount(vfsp, flags, crp)
 28  *                                                 41  *
 29  * FUNCTION:    vfs_umount()                       42  * FUNCTION:    vfs_umount()
 30  *                                                 43  *
 31  * PARAMETERS:  vfsp    - virtual file system      44  * PARAMETERS:  vfsp    - virtual file system pointer
 32  *              flags   - unmount for shutdown     45  *              flags   - unmount for shutdown
 33  *              crp     - credential               46  *              crp     - credential
 34  *                                                 47  *
 35  * RETURN :     EBUSY   - device has open file     48  * RETURN :     EBUSY   - device has open files
 36  */                                                49  */
 37 int jfs_umount(struct super_block *sb)             50 int jfs_umount(struct super_block *sb)
 38 {                                                  51 {
                                                   >>  52         struct address_space *bdev_mapping = sb->s_bdev->bd_inode->i_mapping;
 39         struct jfs_sb_info *sbi = JFS_SBI(sb);     53         struct jfs_sb_info *sbi = JFS_SBI(sb);
 40         struct inode *ipbmap = sbi->ipbmap;        54         struct inode *ipbmap = sbi->ipbmap;
 41         struct inode *ipimap = sbi->ipimap;        55         struct inode *ipimap = sbi->ipimap;
 42         struct inode *ipaimap = sbi->ipaimap;      56         struct inode *ipaimap = sbi->ipaimap;
 43         struct inode *ipaimap2 = sbi->ipaimap2     57         struct inode *ipaimap2 = sbi->ipaimap2;
 44         struct jfs_log *log;                       58         struct jfs_log *log;
 45         int rc = 0;                                59         int rc = 0;
 46                                                    60 
 47         jfs_info("UnMount JFS: sb:0x%p", sb);      61         jfs_info("UnMount JFS: sb:0x%p", sb);
 48                                                    62 
 49         /*                                         63         /*
 50          *      update superblock and close lo !!  64          *      update superblock and close log 
 51          *                                         65          *
 52          * if mounted read-write and log based     66          * if mounted read-write and log based recovery was enabled
 53          */                                        67          */
 54         if ((log = sbi->log))                      68         if ((log = sbi->log))
 55                 /*                                 69                 /*
 56                  * Wait for outstanding transa !!  70                  * Wait for outstanding transactions to be written to log: 
 57                  */                                71                  */
 58                 jfs_flush_journal(log, 2);         72                 jfs_flush_journal(log, 2);
 59                                                    73 
 60         /*                                         74         /*
 61          * close fileset inode allocation map      75          * close fileset inode allocation map (aka fileset inode)
 62          */                                        76          */
 63         diUnmount(ipimap, 0);                      77         diUnmount(ipimap, 0);
 64                                                    78 
 65         diFreeSpecial(ipimap);                     79         diFreeSpecial(ipimap);
 66         sbi->ipimap = NULL;                        80         sbi->ipimap = NULL;
 67                                                    81 
 68         /*                                         82         /*
 69          * close secondary aggregate inode all     83          * close secondary aggregate inode allocation map
 70          */                                        84          */
                                                   >>  85         ipaimap2 = sbi->ipaimap2;
 71         if (ipaimap2) {                            86         if (ipaimap2) {
 72                 diUnmount(ipaimap2, 0);            87                 diUnmount(ipaimap2, 0);
 73                 diFreeSpecial(ipaimap2);           88                 diFreeSpecial(ipaimap2);
 74                 sbi->ipaimap2 = NULL;              89                 sbi->ipaimap2 = NULL;
 75         }                                          90         }
 76                                                    91 
 77         /*                                         92         /*
 78          * close aggregate inode allocation ma     93          * close aggregate inode allocation map
 79          */                                        94          */
                                                   >>  95         ipaimap = sbi->ipaimap;
 80         diUnmount(ipaimap, 0);                     96         diUnmount(ipaimap, 0);
 81         diFreeSpecial(ipaimap);                    97         diFreeSpecial(ipaimap);
 82         sbi->ipaimap = NULL;                       98         sbi->ipaimap = NULL;
 83                                                    99 
 84         /*                                        100         /*
 85          * close aggregate block allocation ma    101          * close aggregate block allocation map
 86          */                                       102          */
 87         dbUnmount(ipbmap, 0);                     103         dbUnmount(ipbmap, 0);
 88                                                   104 
 89         diFreeSpecial(ipbmap);                    105         diFreeSpecial(ipbmap);
 90         sbi->ipbmap = NULL;                    !! 106         sbi->ipimap = NULL;
 91                                                   107 
 92         /*                                        108         /*
 93          * Make sure all metadata makes it to     109          * Make sure all metadata makes it to disk before we mark
 94          * the superblock as clean                110          * the superblock as clean
 95          */                                       111          */
 96         filemap_write_and_wait(sbi->direct_ino !! 112         filemap_fdatawrite(bdev_mapping);
                                                   >> 113         filemap_fdatawait(bdev_mapping);
 97                                                   114 
 98         /*                                        115         /*
 99          * ensure all file system file pages a    116          * ensure all file system file pages are propagated to their
100          * home blocks on disk (and their in-m !! 117          * home blocks on disk (and their in-memory buffer pages are 
101          * invalidated) BEFORE updating file s    118          * invalidated) BEFORE updating file system superblock state
102          * (to signify file system is unmounte !! 119          * (to signify file system is unmounted cleanly, and thus in 
103          * consistent state) and log superbloc !! 120          * consistent state) and log superblock active file system 
104          * list (to signify skip logredo()).      121          * list (to signify skip logredo()).
105          */                                       122          */
106         if (log) {              /* log = NULL     123         if (log) {              /* log = NULL if read-only mount */
107                 updateSuper(sb, FM_CLEAN);     !! 124                 rc = updateSuper(sb, FM_CLEAN);
108                                                   125 
109                 /*                                126                 /*
110                  * close log:                  !! 127                  * close log: 
111                  *                                128                  *
112                  * remove file system from log    129                  * remove file system from log active file system list.
113                  */                               130                  */
114                 rc = lmLogClose(sb);           !! 131                 rc = lmLogClose(sb, log);
115         }                                         132         }
116         jfs_info("UnMount JFS Complete: rc = %    133         jfs_info("UnMount JFS Complete: rc = %d", rc);
117         return rc;                                134         return rc;
118 }                                                 135 }
119                                                   136 
120                                                   137 
121 int jfs_umount_rw(struct super_block *sb)         138 int jfs_umount_rw(struct super_block *sb)
122 {                                                 139 {
                                                   >> 140         struct address_space *bdev_mapping = sb->s_bdev->bd_inode->i_mapping;
123         struct jfs_sb_info *sbi = JFS_SBI(sb);    141         struct jfs_sb_info *sbi = JFS_SBI(sb);
124         struct jfs_log *log = sbi->log;           142         struct jfs_log *log = sbi->log;
125                                                   143 
126         if (!log)                                 144         if (!log)
127                 return 0;                         145                 return 0;
128                                                   146 
129         /*                                        147         /*
130          * close log:                          !! 148          * close log: 
131          *                                        149          *
132          * remove file system from log active     150          * remove file system from log active file system list.
133          */                                       151          */
134         jfs_flush_journal(log, 2);                152         jfs_flush_journal(log, 2);
135                                                   153 
136         /*                                        154         /*
137          * Make sure all metadata makes it to     155          * Make sure all metadata makes it to disk
138          */                                       156          */
139         dbSync(sbi->ipbmap);                      157         dbSync(sbi->ipbmap);
140         diSync(sbi->ipimap);                      158         diSync(sbi->ipimap);
141                                                   159 
142         /*                                        160         /*
143          * Note that we have to do this even i    161          * Note that we have to do this even if sync_blockdev() will
144          * do exactly the same a few instructi    162          * do exactly the same a few instructions later:  We can't
145          * mark the superblock clean before ev    163          * mark the superblock clean before everything is flushed to
146          * disk.                                  164          * disk.
147          */                                       165          */
148         filemap_write_and_wait(sbi->direct_ino !! 166         filemap_fdatawrite(bdev_mapping);
                                                   >> 167         filemap_fdatawait(bdev_mapping);
149                                                   168 
150         updateSuper(sb, FM_CLEAN);                169         updateSuper(sb, FM_CLEAN);
                                                   >> 170         sbi->log = NULL;
151                                                   171 
152         return lmLogClose(sb);                 !! 172         return lmLogClose(sb, log);
153 }                                                 173 }
154                                                   174 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php