[Samba] Samba print problem when folder spool is a dedicated mounted filesystem: when smbprn.xxxxx temp file is removed do not free space (is still open?)

Dario Lesca d.lesca at solinos.it
Wed Feb 16 10:20:09 UTC 2022

Due to a particular and random windows printer driver problem that
generate huge spool jobs file, I have converted the /var/spool/samba
folder into a dedicate filesystem mounted on it, to mitigate a /var
filesystem full when some times the printer windows driver goes crazy.

But in this case, the samba temp spool file (smbprn.slBOAV) it is
removed when it is still open and the space is not freed:

[root at rocky8 ~]# df /var/spool/samba
File system               1K-blocchi Usati Disponib. Uso% Montato su
/dev/mapper/rl-spoolsamba    2086912 47612   2039300   3% /var/spool/samba

[root at rocky8 ~]# lsof /var/spool/samba;ls -ltr /var/spool/samba/* -d
smbd    1676 root  cwd    DIR  253,3       17  128 /var/spool/samba
smbd    1676 root   14u   REG  253,3       23  132 /var/spool/samba/smbprn.slBOAV (deleted)
smbd    1676 root   51u   REG  253,3       23  133 /var/spool/samba/smbprn.UQmo5T (deleted)
drwxrwxrwx. 2 root root 6 15 feb 04.22 /var/spool/samba/tmp

Only when the windows client (or smbclient) connection is closed this
space set free.

If I unmount the filesystem and I retry print on same printer all work
fine and the space is immediately set free.

For test I have use a dumb printer, but the problem occur whit all
printers and printing= setting type (CUPS or sysv)

        comment = Printer with Restricted Access
        path = /var/spool/samba/
        browseable = yes
        printable = yes
        writable = no
        guest ok = yes
        printing = sysv
        print command = mkdir -p -m777 /tmp/print.d/; echo Printing %s >> /tmp/print.d/print.log; cp %s /tmp/print.d/;rm %s

If I use the default path=/tmp setting all work fine.

The problem occur when the path= setting point to a filesystem or to
subdir of this filesystem (es: /var/spool/samba/tmp)

Is this a know issue or is a my misconfiguration?

Many thanks.

Dario Lesca
(inviato dal mio Linux Fedora 35 Workstation)

More information about the samba mailing list