skipped 1634 lines 1635 1635 * We open file w/o lseek, as mappings don't care about it 1636 1636 */ 1637 1637 1638 - BUG_ON(vma->vmfd == NULL); 1639 - if (vma->e->has_fdflags) 1640 - flags = vma->e->fdflags; 1641 - else if ((vma->e->prot & PROT_WRITE) && 1642 - vma_area_is(vma, VMA_FILE_SHARED)) 1643 - flags = O_RDWR; 1644 - else 1645 - flags = O_RDONLY; 1638 + BUG_ON(( vma->vmfd == NULL) | | ! vma - > e - > has_fdflags ); 1639 + flags = vma->e->fdflags; 1646 1640 1647 1641 ret = open_path(vma->vmfd, do_open_reg_noseek_flags, &flags); 1648 1642 if (ret < 0) skipped 6 lines 1655 1649 int collect_filemap(struct vma_area *vma) 1656 1650 { 1657 1651 struct file_desc *fd; 1652 + 1653 + if (!vma->e->has_fdflags) { 1654 + /* Make a wild guess for the fdflags */ 1655 + vma->e->has_fdflags = true; 1656 + if ((vma->e->prot & PROT_WRITE) && 1657 + vma_area_is(vma, VMA_FILE_SHARED)) 1658 + vma->e->fdflags = O_RDWR; 1659 + else 1660 + vma->e->fdflags = O_RDONLY; 1661 + } 1658 1662 1659 1663 fd = collect_special_file(vma->e->shmid); 1660 1664 if (!fd) skipped 90 lines