[PATCH 3/3] security: Don't fail if locking a file on NFS mount fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The way that our file locking works is that we open() the file we
want to lock and then use fcntl(fd, F_SETLKW, ...) to lock it.
The problem is, we are doing all of these as root which doesn't
work if the file lives on root squashed NFS, because if it does
then the open() fails. The way to resolve this is to make this a
non fatal error and leave callers deal with this (i.e. disable
remembering) - implemented in the previous commit.

https://bugzilla.redhat.com/show_bug.cgi?id=1804672

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/security/security_manager.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/security/security_manager.c b/src/security/security_manager.c
index 1e998a6579..9f4bd7f8df 100644
--- a/src/security/security_manager.c
+++ b/src/security/security_manager.c
@@ -1345,6 +1345,11 @@ virSecurityManagerMetadataLock(virSecurityManagerPtr mgr G_GNUC_UNUSED,
             }
 #endif /* !WIN32 */
 
+            if (virFileIsSharedFS(p)) {
+                /* Probably a root squashed NFS. */
+                continue;
+            }
+
             virReportSystemError(errno,
                                  _("unable to open %s"),
                                  p);
-- 
2.24.1





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux