Messages in this thread Patch in this message |  | | | From | Andreas Schwab <> | | Date | Fri, 1 Aug 97 10:54:15 +0200 | | Subject | [patch] Reimplementation of fs_may_remount_ro in 2.1.47 |
| |
This patch reimplements the function fs_may_remount_ro. Actually it is pretty much identical to the previous implementation, except for s/f_inode/f_dentry->d_inode/. As before, this function should be moved to file_table.c.
--- linux-2.1.47/fs/inode.c.~1~ Mon Jul 28 17:29:46 1997 +++ linux-2.1.47/fs/inode.c Sat Jul 26 13:30:25 1997 @@ -504,7 +504,22 @@ return root->d_count == 1; } +/* This belongs in file_table.c, not here... */ int fs_may_remount_ro(struct super_block *sb) { - return 1; + struct file *file; + kdev_t dev = sb->s_dev; + + /* Check that no files are currently opened for writing. */ + for (file = inuse_filps; file; file = file->f_next) { + struct inode *inode; + if (!file->f_dentry) + continue; + inode = file->f_dentry->d_inode; + if (!inode || inode->i_dev != dev) + continue; + if (S_ISREG(inode->i_mode) && file->f_mode & FMODE_WRITE) + return 0; + } + return 1; /* Tis' cool bro. */ } -- Andreas Schwab "And now for something schwab@issan.informatik.uni-dortmund.de completely different"
|  |