Skip ro check for snapshots since they are always ro regardless if ro
flag is passed by mount or not. This allows multi-mounting snapshots
without requiring to specify ro flag.
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Signed-off-by: Chunwei Chen <david.chen@nutanix.com>
Closes #16299
{
struct super_block *s;
objset_t *os;
+ boolean_t issnap = B_FALSE;
int err;
err = dmu_objset_hold(zm->mnt_osname, FTAG, &os);
if (zpl_enter(zfsvfs, FTAG) == 0) {
if (os != zfsvfs->z_os)
err = -SET_ERROR(EBUSY);
+ issnap = zfsvfs->z_issnap;
zpl_exit(zfsvfs, FTAG);
} else {
err = -SET_ERROR(EBUSY);
return (ERR_PTR(err));
}
s->s_flags |= SB_ACTIVE;
- } else if ((flags ^ s->s_flags) & SB_RDONLY) {
+ } else if (!issnap && ((flags ^ s->s_flags) & SB_RDONLY)) {
+ /*
+ * Skip ro check for snap since snap is always ro regardless
+ * ro flag is passed by mount or not.
+ */
deactivate_locked_super(s);
return (ERR_PTR(-EBUSY));
}