Restrict auto-fcntl to non-v2 schemes.
This commit is contained in:
+7
-1
@@ -74,6 +74,12 @@ impl KernelScheme for RootScheme {
|
||||
let path_box = path.to_string().into_boxed_str();
|
||||
let mut schemes = scheme::schemes_mut();
|
||||
|
||||
let v2 = flags & O_FSYNC == O_FSYNC;
|
||||
|
||||
if !v2 {
|
||||
//log::warn!("Context {} opened a v1 scheme", context::current().read().name);
|
||||
}
|
||||
|
||||
let (_scheme_id, inner) =
|
||||
schemes.insert_and_pass(self.scheme_ns, path, |scheme_id| {
|
||||
let inner = Arc::new(UserInner::new(
|
||||
@@ -81,7 +87,7 @@ impl KernelScheme for RootScheme {
|
||||
scheme_id,
|
||||
// TODO: This is a hack, but eventually the legacy interface will be
|
||||
// removed.
|
||||
flags & O_FSYNC == O_FSYNC,
|
||||
v2,
|
||||
id,
|
||||
path_box,
|
||||
flags,
|
||||
|
||||
+7
-6
@@ -1533,11 +1533,12 @@ impl KernelScheme for UserScheme {
|
||||
call_flags: u32,
|
||||
stored_flags: u32,
|
||||
) -> Result<usize> {
|
||||
if call_flags != stored_flags {
|
||||
let inner = self.inner.upgrade().ok_or(Error::new(ENODEV))?;
|
||||
|
||||
if call_flags != stored_flags && !inner.v2 {
|
||||
self.fcntl(file, F_SETFL, call_flags as usize)?;
|
||||
}
|
||||
|
||||
let inner = self.inner.upgrade().ok_or(Error::new(ENODEV))?;
|
||||
let mut address = inner.capture_user(buf)?;
|
||||
let result = inner.call(
|
||||
Opcode::Read,
|
||||
@@ -1552,7 +1553,7 @@ impl KernelScheme for UserScheme {
|
||||
);
|
||||
address.release()?;
|
||||
|
||||
if call_flags != stored_flags {
|
||||
if call_flags != stored_flags && !inner.v2 {
|
||||
self.fcntl(file, F_SETFL, stored_flags as usize)?;
|
||||
}
|
||||
|
||||
@@ -1567,11 +1568,11 @@ impl KernelScheme for UserScheme {
|
||||
call_flags: u32,
|
||||
stored_flags: u32,
|
||||
) -> Result<usize> {
|
||||
if call_flags != stored_flags {
|
||||
let inner = self.inner.upgrade().ok_or(Error::new(ENODEV))?;
|
||||
if call_flags != stored_flags && !inner.v2 {
|
||||
self.fcntl(file, F_SETFL, call_flags as usize)?;
|
||||
}
|
||||
|
||||
let inner = self.inner.upgrade().ok_or(Error::new(ENODEV))?;
|
||||
let mut address = inner.capture_user(buf)?;
|
||||
let result = inner.call(
|
||||
Opcode::Write,
|
||||
@@ -1586,7 +1587,7 @@ impl KernelScheme for UserScheme {
|
||||
);
|
||||
address.release()?;
|
||||
|
||||
if call_flags != stored_flags {
|
||||
if call_flags != stored_flags && !inner.v2 {
|
||||
self.fcntl(file, F_SETFL, stored_flags as usize)?;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user