• Morphit
    link
    fedilink
    7
    edit-2
    8 months ago

    It should use systemd-inhibit (or whatever the dmesg dbus service is) to tell the system it’s busy. How else would the system know?

    • @just_another_person
      link
      1
      edit-2
      8 months ago

      “It” meaning Samba? Samba is only a collection of tools and libraries. It doesn’t copy your files for you. As far as your system’s power management situation goes, that is all handled via various monitors to check statuses of certain things IN /proc, /sys, dbus, lsof…etc.

      Not every program or service on your system is calling out to something else to say “HEY, IM WORKIN’ HEEERRRRREEE” everytime it goes to do something like copy files or do something YOU seem worthy of preventing sleep. Depending on your environment, you can tune this however you want, or how about just not sleeping and solving your problem right there? Write a helper or alias to trigger something that inhibits sleep when you’re doing something important, or maybe make sure you’re using proper mounts and a file manager. Lots of options here.

      TLDR: Samba project ain’t gonna fix your power issues.

      • Morphit
        link
        fedilink
        68 months ago

        Not every program or service on your system

        Of course not, but plenty do when running a task where the user is unlikely to make inputs and also doesn’t want the machine to sleep. Firefox can call org.gnome.SessionManager.Inhibit over dbus with the “video-playing” description, same for VLC. Transmission can call that interface while a transfer is in progress (with a config toggle). It seems a pretty reasonable default for samba to do the same while a long-running file transfer is ongoing.

        [Samba] doesn’t copy your files for you.

        Sure but it has to know when a transfer is running. It would be nice to have the option to inhibit sleep if the transfer is runs for a significant amount of time.

        • @just_another_person
          link
          28 months ago

          I’m not shading you here, I just think You’re kind of missing the point of where samba itself comes into play as far as inhibiting sleep goes. There a myriad different ways you can be copying files where Samba wouldn’t even know as a client.

          Are you using network mounts? Well then you’re operating in Fuse most likely.

          Are you using a GUI file manager under Gnome? Could be gvfs, could be fuse, a combo, or a direct call to SMB libs, who knows. No Samba proc calls though.

          Are you copying using smbclient directly from a cli? Well maybe then samba as a construct would know about it and be able to do something.

          Point is, it’s not really Samba’s problem. It is solely a cohesive collection of things that group together to act as a Windows compatible file server and domain controller.

          Try looking at Caffeine or the KDE equivalent depending on what you’re running. Maybe even consider not using SMB at all if it’s that big of an issue. Or maybe network mounts and rsync would work better for you. Literally thousands of workarounds and possibilities to solve your particular problem.

          • Morphit
            link
            fedilink
            1
            edit-2
            8 months ago

            For sure, I don’t know the internals of Samba, but surely the server knows that it’s serving a file no matter how the client accesses it. I don’t think a few dbus messages would cause issues.

            I have my own service that looks at the network traffic via /proc and a few other things. That sends the system to sleep itself if everything looks truly idle.

            I do think it would be nice for a file server like samba to inhibit sleep using the standard interface for it. But yeah, I appreciate there are complications, like video playback is presumably pulling a small extent of a file at a time, so there would have to be some kind of timer before releasing the inhibition or the system would sleep between transfers.

            EDIT: I just took a look; with loglevel set to 3 for smb and smb2 I see log messages like:

            smbd_smb2_read: fnum 1712966762, file my_video.mkv, length=262144 offset=82366464 read=262144
            

            These occur at most 10 seconds apart when playing a video over a share from another host. I don’t see why the smbd daemon couldn’t inhibit sleep untill smbd_smb2_read hasn’t run for a minute or so. You could have a script that monitors that log output and does this externally but it’d be nice to have built in.

            • @just_another_person
              link
              0
              edit-2
              8 months ago

              The server side should never be expected to sleep at all, so that’s just a totally different thing. I was under the impression you were having issues with the client. If you have sleep enabled on the server/service side of things and you expect it to work, then there’s yer problem. You’ll need some custom work to prevent your power profiles and such from overriding systemd-sleep or whatever you intend to happen.

              • Morphit
                link
                fedilink
                48 months ago

                Ah, that’s the misunderstanding. The original comment was talking about “watching something on another pc”. Like playing a video from a desktop PC on a laptop in another room. So it’s the samba server we want to prevent from sleeping, not the client. Yes it’d be nice to have a 24/7 media server set up, but for the simple case of sharing a file from one PC to another, it’d be nice for the server not to sleep in the middle of it by default.