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

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/lofi.c
          +++ new/usr/src/uts/common/io/lofi.c
↓ open down ↓ 467 lines elided ↑ open up ↑
 468  468          if (lsp == NULL) {
 469  469                  mutex_exit(&lofi_lock);
 470  470                  return (EINVAL);
 471  471          }
 472  472  
 473  473          if (lsp->ls_vp == NULL) {
 474  474                  mutex_exit(&lofi_lock);
 475  475                  return (ENXIO);
 476  476          }
 477  477  
 478      -        if (mark_opened(lsp, otyp) == -1) {
      478 +        if (lsp->ls_readonly && (flag & FWRITE)) {
 479  479                  mutex_exit(&lofi_lock);
 480      -                return (EINVAL);
      480 +                return (EROFS);
 481  481          }
 482  482  
 483      -        if (lsp->ls_readonly && (flag & FWRITE)) {
      483 +        if (mark_opened(lsp, otyp) == -1) {
 484  484                  mutex_exit(&lofi_lock);
 485      -                return (EROFS);
      485 +                return (EINVAL);
 486  486          }
 487  487  
 488  488          mutex_exit(&lofi_lock);
 489  489          return (0);
 490  490  }
 491  491  
 492  492  /*ARGSUSED*/
 493  493  static int
 494  494  lofi_close(dev_t dev, int flag, int otyp, struct cred *credp)
 495  495  {
↓ open down ↓ 2320 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX