Print this page
4278 read-only lofi devices can never be removed if used

@@ -473,18 +473,18 @@
         if (lsp->ls_vp == NULL) {
                 mutex_exit(&lofi_lock);
                 return (ENXIO);
         }
 
-        if (mark_opened(lsp, otyp) == -1) {
+        if (lsp->ls_readonly && (flag & FWRITE)) {
                 mutex_exit(&lofi_lock);
-                return (EINVAL);
+                return (EROFS);
         }
 
-        if (lsp->ls_readonly && (flag & FWRITE)) {
+        if (mark_opened(lsp, otyp) == -1) {
                 mutex_exit(&lofi_lock);
-                return (EROFS);
+                return (EINVAL);
         }
 
         mutex_exit(&lofi_lock);
         return (0);
 }