Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
5f7af273
Commit
5f7af273
authored
Oct 15, 2002
by
Eric Sandeen
Committed by
Christoph Hellwig
Oct 15, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
XFS: Rearrange how xfs deals with read-only mounts vs. read-only devices.
Modid: 2.5.x-xfs:slinx:129120a
parent
f93d3d7d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
33 additions
and
59 deletions
+33
-59
fs/xfs/linux/xfs_lrw.c
fs/xfs/linux/xfs_lrw.c
+7
-31
fs/xfs/linux/xfs_lrw.h
fs/xfs/linux/xfs_lrw.h
+1
-3
fs/xfs/xfs_log_recover.c
fs/xfs/xfs_log_recover.c
+20
-9
fs/xfs/xfs_mount.c
fs/xfs/xfs_mount.c
+4
-7
fs/xfs/xfs_qm.c
fs/xfs/xfs_qm.c
+1
-9
No files found.
fs/xfs/linux/xfs_lrw.c
View file @
5f7af273
...
...
@@ -1836,45 +1836,21 @@ XFS_log_write_unmount_ro(bhv_desc_t *bdp)
}
/*
* I
n these two situations we disregard the readonly mount flag and
*
temporarily enable writes (we must, to ensure metadata integrity)
.
* I
f the underlying (log or data) device is readonly, there are some
*
operations that cannot proceed
.
*/
STATIC
int
xfs_
is_read_only
(
xfs_mount_t
*
mp
)
int
xfs_
dev_is_read_only
(
xfs_mount_t
*
mp
,
char
*
message
)
{
if
(
bdev_read_only
(
mp
->
m_ddev_targp
->
pbr_bdev
)
||
bdev_read_only
(
mp
->
m_logdev_targp
->
pbr_bdev
))
{
cmn_err
(
CE_NOTE
,
"XFS: %s required on read-only device."
,
message
);
cmn_err
(
CE_NOTE
,
"XFS: write access unavailable, cannot proceed."
);
return
EROFS
;
}
cmn_err
(
CE_NOTE
,
"XFS: write access will be enabled during mount."
);
XFS_MTOVFS
(
mp
)
->
vfs_flag
&=
~
VFS_RDONLY
;
return
0
;
}
int
xfs_recover_read_only
(
xlog_t
*
log
)
{
cmn_err
(
CE_NOTE
,
"XFS: WARNING: "
"recovery required on readonly filesystem."
);
return
xfs_is_read_only
(
log
->
l_mp
);
}
int
xfs_quotacheck_read_only
(
xfs_mount_t
*
mp
)
{
cmn_err
(
CE_NOTE
,
"XFS: WARNING: "
"quotacheck required on readonly filesystem."
);
return
xfs_is_read_only
(
mp
);
}
int
xfs_quotaino_create_read_only
(
xfs_mount_t
*
mp
)
{
cmn_err
(
CE_NOTE
,
"XFS: WARNING: "
"Quota inode creation required on readonly filesystem."
);
return
xfs_is_read_only
(
mp
);
return
0
;
}
fs/xfs/linux/xfs_lrw.h
View file @
5f7af273
...
...
@@ -62,9 +62,7 @@ extern ssize_t xfs_write (
loff_t
*
offp
,
struct
cred
*
credp
);
extern
int
xfs_recover_read_only
(
xlog_t
*
);
extern
int
xfs_quotacheck_read_only
(
xfs_mount_t
*
);
extern
int
xfs_quotaino_create_read_only
(
xfs_mount_t
*
);
extern
int
xfs_dev_is_read_only
(
xfs_mount_t
*
,
char
*
);
extern
void
XFS_log_write_unmount_ro
(
bhv_desc_t
*
);
...
...
fs/xfs/xfs_log_recover.c
View file @
5f7af273
...
...
@@ -873,9 +873,19 @@ xlog_find_tail(xlog_t *log,
* overwrite the unmount record after a clean unmount.
*
* Do this only if we are going to recover the filesystem
*
* NOTE: This used to say "if (!readonly)"
* However on Linux, we can & do recover a read-only filesystem.
* We only skip recovery if NORECOVERY is specified on mount,
* in which case we would not be here.
*
* But... if the -device- itself is readonly, just skip this.
* We can't recover this device anyway, so it won't matter.
*/
if
(
!
readonly
)
if
(
!
bdev_read_only
(
log
->
l_mp
->
m_logdev_targp
->
pbr_bdev
))
{
error
=
xlog_clear_stale_blocks
(
log
,
tail_lsn
);
}
#endif
bread_err:
...
...
@@ -3521,17 +3531,20 @@ xlog_recover(xlog_t *log, int readonly)
* error message.
* ...but this is no longer true. Now, unless you specify
* NORECOVERY (in which case this function would never be
* called), it enables read-write access long enough to do
* recovery.
* called), we just go ahead and recover. We do this all
* under the vfs layer, so we can get away with it unless
* the device itself is read-only, in which case we fail.
*/
if
(
readonly
)
{
#ifdef __KERNEL__
if
((
error
=
xfs_recover_read_only
(
log
)))
return
error
;
if
((
error
=
xfs_dev_is_read_only
(
log
->
l_mp
,
"recovery required"
)))
{
return
error
;
}
#else
if
(
readonly
)
{
return
ENOSPC
;
#endif
}
#endif
#ifdef __KERNEL__
#if defined(DEBUG) && defined(XFS_LOUD_RECOVERY)
...
...
@@ -3548,8 +3561,6 @@ xlog_recover(xlog_t *log, int readonly)
#endif
error
=
xlog_do_recover
(
log
,
head_blk
,
tail_blk
);
log
->
l_flags
|=
XLOG_RECOVERY_NEEDED
;
if
(
readonly
)
XFS_MTOVFS
(
log
->
l_mp
)
->
vfs_flag
|=
VFS_RDONLY
;
}
return
error
;
}
/* xlog_recover */
...
...
fs/xfs/xfs_mount.c
View file @
5f7af273
...
...
@@ -937,8 +937,7 @@ xfs_mountfs(
if
(((
quotaondisk
&&
!
XFS_IS_QUOTA_ON
(
mp
))
||
(
!
quotaondisk
&&
XFS_IS_QUOTA_ON
(
mp
)))
&&
(
bdev_read_only
(
mp
->
m_ddev_targp
->
pbr_bdev
)
||
bdev_read_only
(
mp
->
m_logdev_targp
->
pbr_bdev
)))
{
xfs_dev_is_read_only
(
mp
,
"changing quota state"
))
{
cmn_err
(
CE_WARN
,
"XFS: device %s is read-only, cannot change "
"quota state. Please mount with%s quota option."
,
...
...
@@ -1030,14 +1029,12 @@ xfs_mountfs(
if
(
needquotamount
)
{
ASSERT
(
mp
->
m_qflags
==
0
);
mp
->
m_qflags
=
quotaflags
;
rootqcheck
=
(
(
XFS_MTOVFS
(
mp
)
->
vfs_flag
&
VFS_RDONLY
)
&&
mp
->
m_dev
==
rootdev
&&
needquotacheck
);
if
(
rootqcheck
&&
(
error
=
xfs_quotacheck_read_only
(
mp
)))
rootqcheck
=
(
mp
->
m_dev
==
rootdev
&&
needquotacheck
);
if
(
rootqcheck
&&
(
error
=
xfs_dev_is_read_only
(
mp
,
"quotacheck"
)))
goto
error2
;
if
(
xfs_qm_mount_quotas
(
mp
))
xfs_mount_reset_sbqflags
(
mp
);
if
(
rootqcheck
)
XFS_MTOVFS
(
mp
)
->
vfs_flag
|=
VFS_RDONLY
;
}
#if defined(DEBUG) && defined(XFS_LOUD_RECOVERY)
...
...
fs/xfs/xfs_qm.c
View file @
5f7af273
...
...
@@ -2039,17 +2039,9 @@ xfs_qm_init_quotainos(
/*
* Create the two inodes, if they don't exist already. The changes
* made above will get added to a transaction and logged in one of
* the qino_alloc calls below. If the device is readonly,
* temporarily switch to read-write to do this.
* the qino_alloc calls below.
*/
if
(
readonly
&&
((
XFS_IS_UQUOTA_ON
(
mp
)
&&
uip
==
NULL
)
||
(
XFS_IS_GQUOTA_ON
(
mp
)
&&
gip
==
NULL
)))
{
if
((
error
=
xfs_quotaino_create_read_only
(
mp
)))
goto
error
;
}
if
(
XFS_IS_UQUOTA_ON
(
mp
)
&&
uip
==
NULL
)
{
if
((
error
=
xfs_qm_qino_alloc
(
mp
,
&
uip
,
sbflags
|
XFS_SB_UQUOTINO
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment